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:
parent
2f7d58afce
commit
1e442c97c8
|
@ -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()
|
||||
|
||||
|
|
Loading…
Reference in New Issue