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 <psychon@znc.in>
This commit is contained in:
parent
2485d334cf
commit
9b44e9a011
|
@ -305,7 +305,10 @@ function tag.object.delete(self, fallback_tag)
|
||||||
if target_scr.selected_tag == nil and ntags > 0 then
|
if target_scr.selected_tag == nil and ntags > 0 then
|
||||||
tag.history.restore(nil, 1)
|
tag.history.restore(nil, 1)
|
||||||
if target_scr.selected_tag == nil then
|
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
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue