WINTERMUTE: Avoid dereferncing null-pointer in TransparentSurface

This commit is contained in:
Einar Johan Trøan Sømåen 2013-04-17 17:08:58 +02:00
parent c303428f48
commit 6ccfac7e33

View File

@ -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;
}