From 2aa198a57b4a09fba0d9c9ad2e86e370bc9d8949 Mon Sep 17 00:00:00 2001 From: Uli Schlachter Date: Wed, 19 Jun 2019 18:20:09 +0200 Subject: [PATCH] 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 --- lib/wibox/widget/base.lua | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/wibox/widget/base.lua b/lib/wibox/widget/base.lua index dc8bf5ff..d3958b2d 100644 --- a/lib/wibox/widget/base.lua +++ b/lib/wibox/widget/base.lua @@ -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,