From b51dc5d5d0b8764165170af1f54b77d6de8cb5a1 Mon Sep 17 00:00:00 2001 From: Matt Holt Date: Fri, 21 Jul 2023 15:32:20 -0600 Subject: core: Refine mutex during reloads (fix #5628) (#5645) Separate currentCtxMu to protect currentCtx, and a new rawCfgMu to protect rawCfg and synchronize loads. --- context.go | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'context.go') 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] } -- cgit v1.2.3