aboutsummaryrefslogtreecommitdiff
path: root/graphics/surface.cpp
diff options
context:
space:
mode:
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() {