Check the bitmap is valid before accessing its height/width/depth

This commit is contained in:
ali kettab 2023-09-24 11:30:45 +01:00
parent b12cdc6739
commit 4bbd313ecf

View file

@ -275,16 +275,22 @@ bool wxBitmap::Create(int width, int height, const wxDC& WXUNUSED(dc))
int wxBitmap::GetHeight() const
{
wxCHECK_MSG( IsOk(), -1, "invalid bitmap" );
return M_PIXDATA.height();
}
int wxBitmap::GetWidth() const
{
wxCHECK_MSG( IsOk(), -1, "invalid bitmap" );
return M_PIXDATA.width();
}
int wxBitmap::GetDepth() const
{
wxCHECK_MSG( IsOk(), -1, "invalid bitmap" );
return M_PIXDATA.depth();
}