Fix crash using RotSprite with width/height == 0 (fix #1056)

This commit is contained in:
David Capello 2016-04-12 17:29:23 -03:00
parent 7c9ba13321
commit a76a1117f1

View File

@ -179,6 +179,9 @@ void rotsprite_image(Image* bmp, const Image* spr, const Image* mask,
int rot_width = xmax - xmin; int rot_width = xmax - xmin;
int rot_height = ymax - ymin; int rot_height = ymax - ymin;
if (rot_width == 0 || rot_height == 0)
return;
int scale = 8; int scale = 8;
base::UniquePtr<Image> bmp_copy(Image::create(bmp->pixelFormat(), rot_width*scale, rot_height*scale, buf[0])); base::UniquePtr<Image> bmp_copy(Image::create(bmp->pixelFormat(), rot_width*scale, rot_height*scale, buf[0]));
base::UniquePtr<Image> tmp_copy(Image::create(spr->pixelFormat(), spr->width()*scale, spr->height()*scale, buf[1])); base::UniquePtr<Image> tmp_copy(Image::create(spr->pixelFormat(), spr->width()*scale, spr->height()*scale, buf[1]));