aboutsummaryrefslogtreecommitdiff
path: root/graphics/surface.cpp
diff options
context:
space:
mode:
authorChris Warren-Smith2011-08-13 07:30:38 +1000
committerChris Warren-Smith2011-08-21 16:38:52 +1000
commit3019b283f92dbd917aca60da291ef98010f10d29 (patch)
treed7cd7da9a72a5e2abd2c8e970c9360c40f352c5b /graphics/surface.cpp
parentbd028d4167e7429ab98b4c847d3fd1a1de682ccd (diff)
downloadscummvm-rg350-3019b283f92dbd917aca60da291ef98010f10d29.tar.gz
scummvm-rg350-3019b283f92dbd917aca60da291ef98010f10d29.tar.bz2
scummvm-rg350-3019b283f92dbd917aca60da291ef98010f10d29.zip
BADA: Prevent assertion failure when allocating zero bytes
Diffstat (limited to 'graphics/surface.cpp')
-rw-r--r--graphics/surface.cpp6
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() {