- memset( data , 0 , size ) ;
- m_memBuf.UngetWriteBuf( size ) ;
-
- m_hBitmap = NULL ;
- m_hBitmap = CGBitmapContextCreate((char*) data, m_width, m_height, 8, m_bytesPerRow, wxMacGetGenericRGBColorSpace(), kCGImageAlphaNoneSkipFirst );
- wxASSERT_MSG( m_hBitmap , wxT("Unable to create CGBitmapContext context") ) ;
- CGContextTranslateCTM( m_hBitmap, 0, m_height );
- CGContextScaleCTM( m_hBitmap, 1, -1 );
-
+ if ( data != NULL )
+ {
+ memset( data , 0 , size ) ;
+ m_memBuf.UngetWriteBuf( size ) ;
+
+ m_hBitmap = CGBitmapContextCreate((char*) data, m_width, m_height, 8, m_bytesPerRow, wxMacGetGenericRGBColorSpace(), kCGImageAlphaNoneSkipFirst );
+ wxASSERT_MSG( m_hBitmap , wxT("Unable to create CGBitmapContext context") ) ;
+ CGContextTranslateCTM( m_hBitmap, 0, m_height );
+ CGContextScaleCTM( m_hBitmap, 1, -1 );
+ } /* data != NULL */