diff options
author | Einar Johan Trøan Sømåen | 2013-04-17 17:08:58 +0200 |
---|---|---|
committer | Einar Johan Trøan Sømåen | 2013-04-17 17:08:58 +0200 |
commit | 6ccfac7e3349733b5ef0b5c3bd320a1313a575cc (patch) | |
tree | 4558828dbcef9c4a8f20ac39120ae8fab0db04ba /engines/wintermute/graphics/transparent_surface.cpp | |
parent | c303428f487204fc40c55b4279deb2c6e8afd733 (diff) | |
download | scummvm-rg350-6ccfac7e3349733b5ef0b5c3bd320a1313a575cc.tar.gz scummvm-rg350-6ccfac7e3349733b5ef0b5c3bd320a1313a575cc.tar.bz2 scummvm-rg350-6ccfac7e3349733b5ef0b5c3bd320a1313a575cc.zip |
WINTERMUTE: Avoid dereferncing null-pointer in TransparentSurface
Diffstat (limited to 'engines/wintermute/graphics/transparent_surface.cpp')
-rw-r--r-- | engines/wintermute/graphics/transparent_surface.cpp | 7 |
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; } |