From 9b44e9a011b9766c3442cff6f10d4fcb083a5612 Mon Sep 17 00:00:00 2001 From: Uli Schlachter Date: Sun, 17 Apr 2016 15:42:15 +0200 Subject: [PATCH] tag:delete(): Allow deletion of the last tag When a tag is deleted, this code tries to select some other tag. If the tag which is to delete is the last tag of a screen, this code failed and indexed a nil value. Fix this with a simple "if". Signed-off-by: Uli Schlachter --- lib/awful/tag.lua | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/awful/tag.lua b/lib/awful/tag.lua index 7f8ad139..4777ea6a 100644 --- a/lib/awful/tag.lua +++ b/lib/awful/tag.lua @@ -305,7 +305,10 @@ function tag.object.delete(self, fallback_tag) if target_scr.selected_tag == nil and ntags > 0 then tag.history.restore(nil, 1) if target_scr.selected_tag == nil then - tags[tags[1] == self and 2 or 1].selected = true + local other_tag = tags[tags[1] == self and 2 or 1] + if other_tag then + other_tag.selected = true + end end end