Common: Fix copy-construction of empty BITMAP_BASE

The bitmap pointer is not checked at copy construct. This is
an instant segfault if you copy an empty bitmap.

Fix the constructor and remove the expected test failure, from the
previous commit.
This commit is contained in:
John Beard
2019-05-23 16:58:08 +01:00
parent d642ac39ae
commit 2dd5757eb5
2 changed files with 13 additions and 7 deletions
+9 -2
View File
@@ -59,8 +59,15 @@ BITMAP_BASE::BITMAP_BASE( const BITMAP_BASE& aSchBitmap )
m_scale = aSchBitmap.m_scale;
m_ppi = aSchBitmap.m_ppi;
m_pixelScaleFactor = aSchBitmap.m_pixelScaleFactor;
m_image = new wxImage( *aSchBitmap.m_image );
m_bitmap = new wxBitmap( *m_image );
m_image = nullptr;
m_bitmap = nullptr;
if( aSchBitmap.m_image )
{
m_image = new wxImage( *aSchBitmap.m_image );
m_bitmap = new wxBitmap( *m_image );
}
}