From 7967d05915c95c8eba7709a46093cc1b6de55572 Mon Sep 17 00:00:00 2001 From: Uli Schlachter Date: Wed, 2 Apr 2014 22:48:06 +0200 Subject: [PATCH] imagebox: Don't try to scale by infinite (FS#1248) When an imagebox was drawn with width or height zero, it tried to calculate the needed scale factor for making the image fit. Sadly, this would be a division by zero aka infinite in this case. Fix this by just not drawing anything if there is no space available. Signed-off-by: Uli Schlachter --- lib/wibox/widget/imagebox.lua.in | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/wibox/widget/imagebox.lua.in b/lib/wibox/widget/imagebox.lua.in index da5163493..5963d0ea9 100644 --- a/lib/wibox/widget/imagebox.lua.in +++ b/lib/wibox/widget/imagebox.lua.in @@ -18,6 +18,7 @@ local imagebox = { mt = {} } --- Draw an imagebox with the given cairo context in the given geometry. function imagebox:draw(wibox, cr, width, height) if not self._image then return end + if width == 0 or height == 0 then return end cr:save()