summaryrefslogtreecommitdiff
path: root/context.go
diff options
context:
space:
mode:
Diffstat (limited to 'context.go')
-rw-r--r--context.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/context.go b/context.go
index 004dee6..85978d4 100644
--- a/context.go
+++ b/context.go
@@ -441,6 +441,12 @@ func (ctx Context) App(name string) (any, error) {
// or stop App modules. The caller is expected to assert to the
// concrete type.
func (ctx Context) AppIfConfigured(name string) any {
+ if ctx.cfg == nil {
+ // this can happen if the currently-active context
+ // is being accessed, but no config has successfully
+ // been loaded yet
+ return nil
+ }
return ctx.cfg.apps[name]
}