wibox.widget.base.place_widget_*: Protect against negative sizes

This commits adds assertions to catch negative width or height.

Would-have-helped-with: https://github.com/awesomeWM/awesome/issues/2799
Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
Uli Schlachter 2019-06-19 18:20:09 +02:00
parent f025409cd3
commit 2aa198a57b
1 changed files with 2 additions and 0 deletions

View File

@ -397,6 +397,8 @@ end
-- @treturn table An opaque object that can be returned from `:layout()`.
-- @staticfct wibox.widget.base.place_widget_via_matrix
function base.place_widget_via_matrix(widget, mat, width, height)
assert(width >= 0, "A widget's width cannot be negative: " .. tostring(width))
assert(height >= 0, "A widget's height cannot be negative: " .. tostring(height))
return {
_widget = widget,
_width = width,