aboutsummaryrefslogtreecommitdiffstats
path: root/lib/ui
diff options
context:
space:
mode:
authorJeffas <dev@jeffas.io>2019-07-23 19:41:15 +0100
committerDrew DeVault <sir@cmpwn.com>2019-07-25 18:12:08 -0400
commitee5b537d538baf38450a2ae655dee53a49aa9824 (patch)
treef1b60a518f870198f7a9477f80816f23b8ab588a /lib/ui
parent454151922558f2e82cc7f7d935d74940afa0107b (diff)
downloadaerc-ee5b537d538baf38450a2ae655dee53a49aa9824.tar.gz
Fix :close on terminal panic
Executing :close on a terminal would panic due to it already having been removed. This is also related to the fact that removing a tab doesn't check for whether it actually found a tab to remove or not.
Diffstat (limited to 'lib/ui')
-rw-r--r--lib/ui/tab.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/ui/tab.go b/lib/ui/tab.go
index a9b24a90..6ee55759 100644
--- a/lib/ui/tab.go
+++ b/lib/ui/tab.go
@@ -57,13 +57,18 @@ func (tabs *Tabs) invalidateChild(d Drawable) {
}
func (tabs *Tabs) Remove(content Drawable) {
+ match := false
for i, tab := range tabs.Tabs {
if tab.Content == content {
tabs.Tabs = append(tabs.Tabs[:i], tabs.Tabs[i+1:]...)
tabs.removeHistory(i)
+ match = true
break
}
}
+ if !match {
+ return
+ }
index, ok := tabs.popHistory()
if ok {
tabs.Select(index)