summaryrefslogtreecommitdiffstats
path: root/pkg/gui/context.go
diff options
context:
space:
mode:
authorDerTeta <derteta@gmx.de>2021-09-25 23:00:17 +0200
committerJesse Duffield <jessedduffield@gmail.com>2021-12-06 22:37:28 +1100
commit3e3151f86ace9dec0af9f554cb0efaa6f43e1831 (patch)
tree8b13644ac2db38c1c514b18232fe84fa8bac9bf0 /pkg/gui/context.go
parent28cdcddb0ac425e0ef2300135d4a6d6f07a19ab6 (diff)
Fix: Don't access a view if it's `nil`
The way the `if` expression in `deactivateContext` was composed, it was possible to have it to evaluate to `true` even though the `view` variable was `nil`. As far as I can tell, this seems to be only possible during tests. Nonetheless, I think the expression looks more "correct" this way.
Diffstat (limited to 'pkg/gui/context.go')
-rw-r--r--pkg/gui/context.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/pkg/gui/context.go b/pkg/gui/context.go
index 66e28fc35..61c7e60a3 100644
--- a/pkg/gui/context.go
+++ b/pkg/gui/context.go
@@ -169,7 +169,7 @@ func (gui *Gui) deactivateContext(c Context) error {
}
// if we are the kind of context that is sent to back upon deactivation, we should do that
- if view != nil && c.GetKind() == TEMPORARY_POPUP || c.GetKind() == PERSISTENT_POPUP || c.GetKey() == COMMIT_FILES_CONTEXT_KEY {
+ if view != nil && (c.GetKind() == TEMPORARY_POPUP || c.GetKind() == PERSISTENT_POPUP || c.GetKey() == COMMIT_FILES_CONTEXT_KEY) {
view.Visible = false
}