diff options
author | Jesse Duffield <jessedduffield@gmail.com> | 2022-02-13 10:57:30 +1100 |
---|---|---|
committer | Jesse Duffield <jessedduffield@gmail.com> | 2022-03-17 19:13:40 +1100 |
commit | 94d66b267dc4c5c415887566dcceb8e267d4ff06 (patch) | |
tree | c46c01411d39b698a0f3907a969797c0e428acbb /pkg/gui/context.go | |
parent | 41527270ed9270ef6c463866e9c761f2285af857 (diff) |
defend against view not yet having a context defined against it
Diffstat (limited to 'pkg/gui/context.go')
-rw-r--r-- | pkg/gui/context.go | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/pkg/gui/context.go b/pkg/gui/context.go index 9f097f78a..8d147f4c9 100644 --- a/pkg/gui/context.go +++ b/pkg/gui/context.go @@ -181,7 +181,12 @@ func (gui *Gui) activateContext(c types.Context, opts ...types.OnFocusOpts) erro if err != nil { return err } - originalViewContextKey := gui.State.ViewContextMap.Get(viewName).GetKey() + + originalViewContext := gui.State.ViewContextMap.Get(viewName) + var originalViewContextKey types.ContextKey = "" + if originalViewContext != nil { + originalViewContextKey = originalViewContext.GetKey() + } gui.setWindowContext(c) gui.setViewTabForContext(c) |