From dcd383dffd17fac97dae980c76e3b07306c776e4 Mon Sep 17 00:00:00 2001 From: Jean-Patrick Guerrero Date: Sat, 16 Jan 2021 03:25:03 +0100 Subject: [PATCH] Add safeguards to i3.new_tab --- init.lua | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/init.lua b/init.lua index aa4d1ad..d3a89e6 100644 --- a/init.lua +++ b/init.lua @@ -1958,6 +1958,18 @@ end local set_fs = i3.set_fs function i3.new_tab(def) + if not is_table(def) or not next(def) then + return err "i3.new_tab(): tab definition missing" + end + + if not true_str(def.name) then + return err "i3.new_tab(): name missing" + end + + if not true_str(def.description) then + return err "i3.new_tab(): description missing" + end + if #tabs < 6 then tabs[#tabs + 1] = def end