BADA: Prevent assertion failure when allocating zero bytes

This commit is contained in:
Chris Warren-Smith 2011-08-13 07:30:38 +10:00
parent bd028d4167
commit 3019b283f9

View file

@ -56,8 +56,10 @@ void Surface::create(uint16 width, uint16 height, const PixelFormat &f) {
format = f;
pitch = w * format.bytesPerPixel;
pixels = calloc(width * height, format.bytesPerPixel);
assert(pixels);
if (width && height) {
pixels = calloc(width * height, format.bytesPerPixel);
assert(pixels);
}
}
void Surface::free() {