Common: Bitmap base: catch copy segfault

Copying an empty image is not checked for nullity,
so it will segfault. Introduce a test for this case,
for fixing as a follow-up.
This commit is contained in:
John Beard 2019-05-23 16:48:08 +01:00
parent 872c8ca37b
commit d642ac39ae
1 changed files with 14 additions and 0 deletions

View File

@ -113,6 +113,20 @@ BOOST_AUTO_TEST_CASE( Empty )
} }
#ifdef HAVE_EXPECTED_FAILURES
BOOST_AUTO_TEST_CASE( EmptyCopy, *boost::unit_test::expected_failures( 1 ) )
{
BITMAP_BASE empty;
BITMAP_BASE copied = empty;
// should still have nothing in it
BOOST_CHECK_EQUAL( copied.GetImageData(), nullptr );
}
#endif
struct TEST_PIXEL_CASE struct TEST_PIXEL_CASE
{ {
int m_x; int m_x;