Skip to content

Commit

Permalink
Oops, fix listener removal... getting there
Browse files Browse the repository at this point in the history
  • Loading branch information
andydotxyz committed May 7, 2020
1 parent ab26bfc commit 3f791e3
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion term.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,11 @@ func (t *Terminal) RemoveListener(listener chan Config) {

for i, l := range t.listeners {
if l == listener {
t.listeners = append(t.listeners[:i], t.listeners[i:]...)
if i < len(t.listeners)-1 {
t.listeners = append(t.listeners[:i], t.listeners[i+1:]...)
} else {
t.listeners = t.listeners[:i]
}
close(l)
return
}
Expand Down

0 comments on commit 3f791e3

Please sign in to comment.