From: joncruz Date: Fri, 23 Feb 2007 06:50:34 +0000 (+0000) Subject: Fixed crash when draw height was zero. X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=74cb47e95220bd0140b3d40fd56063c73c364a0e;p=inkscape.git Fixed crash when draw height was zero. --- diff --git a/src/widgets/icon.cpp b/src/widgets/icon.cpp index dd7770ac1..adf876949 100644 --- a/src/widgets/icon.cpp +++ b/src/widgets/icon.cpp @@ -529,12 +529,17 @@ static void sp_icon_paint(SPIcon *icon, GdkRectangle const *area) int const x1 = std::min(area->x + area->width, widget.allocation.x + padx + static_cast(icon->psize) ); int const y1 = std::min(area->y + area->height, widget.allocation.y + pady + static_cast(icon->psize) ); - gdk_draw_pixbuf(GDK_DRAWABLE(widget.window), NULL, image, - x0 - widget.allocation.x - padx, - y0 - widget.allocation.y - pady, - x0, y0, - x1 - x0, y1 - y0, - GDK_RGB_DITHER_NORMAL, x0, y0); + int width = x1 - x0; + int height = y1 - y0; + // Limit drawing to when we actually have something. Avoids some crashes. + if ( (width > 0) && (height > 0) ) { + gdk_draw_pixbuf(GDK_DRAWABLE(widget.window), NULL, image, + x0 - widget.allocation.x - padx, + y0 - widget.allocation.y - pady, + x0, y0, + width, height, + GDK_RGB_DITHER_NORMAL, x0, y0); + } } }