mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-06-15 00:15:32 +02:00
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.
This commit is contained in:
@ -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
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user