tag: Fix restoring invalid tags from history (#963)

If:

 1) An app is open in a tag
 2) A new tag is created
 3) The app is closed in the first tag
 4) The first tag is deleted
 5) The new tag is deleted

Then this history would try to restore an inactive tag without
a screen. Bad things will then happen.
This commit is contained in:
Emmanuel Lepage Vallée 2016-06-12 07:09:09 -04:00 committed by Daniel Hahler
parent 2173d19892
commit f5cfc03e49
1 changed files with 3 additions and 1 deletions

View File

@ -395,7 +395,9 @@ function tag.history.restore(screen, idx)
tag.viewnone(s) tag.viewnone(s)
-- select tags from the history entry -- select tags from the history entry
for _, t in ipairs(data.history[s][i]) do for _, t in ipairs(data.history[s][i]) do
t.selected = true if t.activated and t.screen then
t.selected = true
end
end end
-- update currently selected tags table -- update currently selected tags table
data.history[s].current = data.history[s][i] data.history[s].current = data.history[s][i]