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 <psychon@znc.in>
This commit is contained in:
Uli Schlachter 2014-04-02 22:48:06 +02:00
parent afa50904fb
commit 7967d05915
1 changed files with 1 additions and 0 deletions

View File

@ -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()