aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEinar Johan Trøan Sømåen2013-04-17 17:08:58 +0200
committerEinar Johan Trøan Sømåen2013-04-17 17:08:58 +0200
commit6ccfac7e3349733b5ef0b5c3bd320a1313a575cc (patch)
tree4558828dbcef9c4a8f20ac39120ae8fab0db04ba
parentc303428f487204fc40c55b4279deb2c6e8afd733 (diff)
downloadscummvm-rg350-6ccfac7e3349733b5ef0b5c3bd320a1313a575cc.tar.gz
scummvm-rg350-6ccfac7e3349733b5ef0b5c3bd320a1313a575cc.tar.bz2
scummvm-rg350-6ccfac7e3349733b5ef0b5c3bd320a1313a575cc.zip
WINTERMUTE: Avoid dereferncing null-pointer in TransparentSurface
-rw-r--r--engines/wintermute/graphics/transparent_surface.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/engines/wintermute/graphics/transparent_surface.cpp b/engines/wintermute/graphics/transparent_surface.cpp
index 11aeb26821..dcdcbf247e 100644
--- a/engines/wintermute/graphics/transparent_surface.cpp
+++ b/engines/wintermute/graphics/transparent_surface.cpp
@@ -218,7 +218,7 @@ Common::Rect TransparentSurface::blit(Graphics::Surface &target, int posX, int p
height = height * 2 / 3;
#endif
- Graphics::Surface *img;
+ Graphics::Surface *img = nullptr;
Graphics::Surface *imgScaled = nullptr;
byte *savedPixels = nullptr;
if ((width != srcImage.w) || (height != srcImage.h)) {
@@ -371,14 +371,15 @@ Common::Rect TransparentSurface::blit(Graphics::Surface &target, int posX, int p
}
}
+ retSize.setWidth(img->w);
+ retSize.setHeight(img->h);
+
if (imgScaled) {
imgScaled->pixels = savedPixels;
imgScaled->free();
delete imgScaled;
}
- retSize.setWidth(img->w);
- retSize.setHeight(img->h);
return retSize;
}