diff options
author | Matt Holt <mholt@users.noreply.github.com> | 2023-07-21 15:32:20 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-07-21 15:32:20 -0600 |
commit | b51dc5d5d0b8764165170af1f54b77d6de8cb5a1 (patch) | |
tree | d94262de1f318855c1cb723dd84ff4de3e96b6c4 /context.go | |
parent | f857b32d65de882dbc945c94029849a7fc895e36 (diff) |
core: Refine mutex during reloads (fix #5628) (#5645)
Separate currentCtxMu to protect currentCtx, and a new
rawCfgMu to protect rawCfg and synchronize loads.
Diffstat (limited to 'context.go')
-rw-r--r-- | context.go | 6 |
1 files changed, 6 insertions, 0 deletions
@@ -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] } |