diff options
author | Chris Warren-Smith | 2011-08-13 07:30:38 +1000 |
---|---|---|
committer | Chris Warren-Smith | 2011-08-21 16:38:52 +1000 |
commit | 3019b283f92dbd917aca60da291ef98010f10d29 (patch) | |
tree | d7cd7da9a72a5e2abd2c8e970c9360c40f352c5b | |
parent | bd028d4167e7429ab98b4c847d3fd1a1de682ccd (diff) | |
download | scummvm-rg350-3019b283f92dbd917aca60da291ef98010f10d29.tar.gz scummvm-rg350-3019b283f92dbd917aca60da291ef98010f10d29.tar.bz2 scummvm-rg350-3019b283f92dbd917aca60da291ef98010f10d29.zip |
BADA: Prevent assertion failure when allocating zero bytes
-rw-r--r-- | graphics/surface.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/graphics/surface.cpp b/graphics/surface.cpp index 0fad25734c..e0b25f22e9 100644 --- a/graphics/surface.cpp +++ b/graphics/surface.cpp @@ -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() { |