From fd2307afd0e596e6c9c4589ec18def38b15017fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emmanuel=20Lepage=20Vall=C3=A9e?= Date: Mon, 21 Aug 2017 15:10:43 -0400 Subject: [PATCH] grid: fix an unavoidable assert (#2017) `:add()` was called with the optional `...` arguments, but the function required at least one argument. --- lib/wibox/layout/grid.lua | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/lib/wibox/layout/grid.lua b/lib/wibox/layout/grid.lua index 1432eafbd..a0734614b 100644 --- a/lib/wibox/layout/grid.lua +++ b/lib/wibox/layout/grid.lua @@ -900,10 +900,14 @@ end -- @tparam number|nil forced_num_rows Forced number of rows (`nil` for automatic). -- @tparam widget ... Widgets that should be added to the layout. -- @function wibox.layout.grid.horizontal -function grid.horizontal(forced_num_rows, ...) +function grid.horizontal(forced_num_rows, widget, ...) local ret = new("horizontal") ret:set_forced_num_rows(forced_num_rows) - ret:add(...) + + if widget then + ret:add(widget, ...) + end + return ret end @@ -914,10 +918,14 @@ end -- @tparam number|nil forced_num_cols Forced number of columns (`nil` for automatic). -- @tparam widget ... Widgets that should be added to the layout. -- @function wibox.layout.grid.vertical -function grid.vertical(forced_num_cols, ...) +function grid.vertical(forced_num_cols, widget, ...) local ret = new("vertical") ret:set_forced_num_cols(forced_num_cols) - ret:add(...) + + if widget then + ret:add(widget, ...) + end + return ret end