Fix nullpointer deref

This commit is contained in:
Jonas Kulla 2013-09-24 22:42:10 +02:00
parent 4f08382c69
commit a9454fdf9c
4 changed files with 9 additions and 3 deletions

View File

@ -645,6 +645,9 @@ SDL_Surface *Bitmap::megaSurface()
void Bitmap::ensureNonMega() void Bitmap::ensureNonMega()
{ {
if (isDisposed())
return;
GUARD_MEGA; GUARD_MEGA;
} }

View File

@ -105,6 +105,7 @@ void Plane::setBitmap(Bitmap *value)
{ {
GUARD_DISPOSED; GUARD_DISPOSED;
if (value)
value->ensureNonMega(); value->ensureNonMega();
p->bitmap = value; p->bitmap = value;

View File

@ -152,6 +152,7 @@ void Sprite::setBitmap(Bitmap *bitmap)
if (p->bitmap == bitmap) if (p->bitmap == bitmap)
return; return;
if (bitmap)
bitmap->ensureNonMega(); bitmap->ensureNonMega();
p->bitmap = bitmap; p->bitmap = bitmap;

View File

@ -715,6 +715,7 @@ void Window::setWindowskin(Bitmap *value)
{ {
GUARD_DISPOSED; GUARD_DISPOSED;
if (value)
value->ensureNonMega(); value->ensureNonMega();
p->windowskin = value; p->windowskin = value;