terminal: fix crashing when terminal size is < 0
authorTiago Vignatti <tiago.vignatti@nokia.com>
Mon, 10 Jan 2011 17:30:04 +0000 (19:30 +0200)
committerKristian Høgsberg <krh@bitplanet.net>
Mon, 10 Jan 2011 19:16:42 +0000 (14:16 -0500)
Just skip drawing when width or height is less than zero.

Signed-off-by: Tiago Vignatti <tiago.vignatti@nokia.com>
clients/terminal.c

index 4bfb06b..1c7cbbf 100644 (file)
@@ -838,6 +838,10 @@ terminal_draw(struct terminal *terminal)
                (int32_t) terminal->extents.max_x_advance;
        height = (rectangle.height - 2 * terminal->margin) /
                (int32_t) terminal->extents.height;
+
+       if (width < 0 || height < 0)
+               return;
+
        terminal_resize(terminal, width, height);
 
        window_draw(terminal->window);