awful.wibox: sanitize height/width args to function new()
When both height and width arguments are provided to the function new() there is a check to see if one of them was a screen percentage, and is expected to be a string. If the user provided absolute pixels, and argument is of type number awesome will crash. Now tostring is used to sanitize the arguments during this check. Signed-off-by: Adrian C. (anrxc) <anrxc@sysphere.org> Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
parent
8cc15d80b4
commit
f641ee411f
|
@ -13,6 +13,7 @@ local capi =
|
|||
client = client
|
||||
}
|
||||
local setmetatable = setmetatable
|
||||
local tostring = tostring
|
||||
local ipairs = ipairs
|
||||
local table = table
|
||||
local type = type
|
||||
|
@ -224,7 +225,7 @@ function new(arg)
|
|||
if arg.height then
|
||||
has_to_stretch = false
|
||||
if arg.screen then
|
||||
local hp = arg.height:match("(%d+)%%")
|
||||
local hp = tostring(arg.height):match("(%d+)%%")
|
||||
if hp then
|
||||
arg.height = capi.screen[arg.screen].geometry.height * hp / 100
|
||||
end
|
||||
|
@ -235,7 +236,7 @@ function new(arg)
|
|||
if arg.width then
|
||||
has_to_stretch = false
|
||||
if arg.screen then
|
||||
local wp = arg.width:match("(%d+)%%")
|
||||
local wp = tostring(arg.width):match("(%d+)%%")
|
||||
if wp then
|
||||
arg.width = capi.screen[arg.screen].geometry.width * wp / 100
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue