summaryrefslogtreecommitdiff
path: root/meme/gui.c
diff options
context:
space:
mode:
authorWerner Almesberger <werner@almesberger.net>2014-09-15 01:00:24 (GMT)
committerWerner Almesberger <werner@almesberger.net>2014-09-15 01:00:24 (GMT)
commitae311573dd3d45f11747fabfc874e7c61903d6b6 (patch)
tree97bb4316bef75841b479f4a3d1060a8c3fcfdf61 /meme/gui.c
parentbd851663c9e901c34a33eb9f725a5d6b1f7dee4a (diff)
downloadmisc-ae311573dd3d45f11747fabfc874e7c61903d6b6.zip
misc-ae311573dd3d45f11747fabfc874e7c61903d6b6.tar.gz
misc-ae311573dd3d45f11747fabfc874e7c61903d6b6.tar.bz2
meme/gui.c (change): drop zero- or negative-sized change areas; better error reporting
Diffstat (limited to 'meme/gui.c')
-rw-r--r--meme/gui.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/meme/gui.c b/meme/gui.c
index c6c8b4a..6f78c63 100644
--- a/meme/gui.c
+++ b/meme/gui.c
@@ -261,10 +261,13 @@ static void change(SDL_Surface *s, int x, int y, int w, int h)
if (y+h >= yres)
h = yres-y-1;
+ if (h <= 0 || w <= 0)
+ return;
+
c = alloc_type(struct change);
c->s = sdl_surface(SDL_SURFACE, w, h);
if (!c->s) {
- fprintf(stderr, "sdl_surface failed\n");
+ fprintf(stderr, "sdl_surface failed: %s\n", SDL_GetError());
exit(1);
}