awful.menu: Handle invalid images better

This fixes problem where e.g. loading an image fails and thus the displayed
layout gets messed up.

Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
Uli Schlachter 2011-03-04 22:07:36 +01:00
parent 01e6e2a07b
commit 07164aa995
1 changed files with 6 additions and 2 deletions

View File

@ -237,9 +237,13 @@ local function add_item(data, num, item_info)
icon = img icon = img
end end
iconbox = wibox.widget.imagebox() iconbox = wibox.widget.imagebox()
iconbox:set_image(icon)
margin:set_left(2) margin:set_left(2)
else if not iconbox:set_image(icon) then
-- Setting the image failed, it must be invalid
iconbox = nil
end
end
if not iconbox then
margin:set_left(data.h + 2) margin:set_left(data.h + 2)
end end