From dc3a2d265985f9fe73ea15e354d4b4859ea3c485 Mon Sep 17 00:00:00 2001 From: Sascha Kruse Date: Sat, 7 Jul 2012 04:31:16 +0200 Subject: [PATCH] don't crash on bad parameters to resizedc --- dunst.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/dunst.c b/dunst.c index e260fa4..9178b4e 100644 --- a/dunst.c +++ b/dunst.c @@ -433,6 +433,20 @@ void draw_win(void) } /* resize window and draw background */ + if (width == 0) { + printf("Warning: width == 0\n"); + return; + } + + if (height == 0) { + printf("Warning: height == 0\n"); + return; + } + + if (font_h == 0) { + printf("Warning: font_h == 0\n"); + return; + } resizedc(dc, width, height * font_h); XResizeWindow(dc->dpy, win, width, height * font_h); drawrect(dc, 0, 0, width, height * font_h, True, colors[NORM]->BG);