From 94d66b267dc4c5c415887566dcceb8e267d4ff06 Mon Sep 17 00:00:00 2001 From: Jesse Duffield Date: Sun, 13 Feb 2022 10:57:30 +1100 Subject: [PATCH] defend against view not yet having a context defined against it --- pkg/gui/context.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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)