Don't throw in a release build if the "keep" namespace is missing.
Fixes https://gitlab.com/kicad/code/kicad/issues/8618
This commit is contained in:
parent
24bf5d3c5c
commit
0d2ea6223b
|
@ -332,21 +332,24 @@ void SETTINGS_MANAGER::SaveColorSettings( COLOR_SETTINGS* aSettings, const std::
|
||||||
if( !aSettings->Store() )
|
if( !aSettings->Store() )
|
||||||
{
|
{
|
||||||
wxLogTrace( traceSettings, "Color scheme %s not modified; skipping save",
|
wxLogTrace( traceSettings, "Color scheme %s not modified; skipping save",
|
||||||
aSettings->GetFilename(), aNamespace );
|
aNamespace );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxASSERT( aSettings->Contains( aNamespace ) );
|
wxASSERT( aSettings->Contains( aNamespace ) );
|
||||||
|
|
||||||
wxLogTrace( traceSettings, "Saving color scheme %s, preserving %s", aSettings->GetFilename(),
|
wxLogTrace( traceSettings, "Saving color scheme %s, preserving %s",
|
||||||
|
aSettings->GetFilename(),
|
||||||
aNamespace );
|
aNamespace );
|
||||||
|
|
||||||
nlohmann::json backup = aSettings->At( aNamespace );
|
OPT<nlohmann::json> backup = aSettings->GetJson( aNamespace );
|
||||||
wxString path = GetColorSettingsPath();
|
wxString path = GetColorSettingsPath();
|
||||||
|
|
||||||
aSettings->LoadFromFile( path );
|
aSettings->LoadFromFile( path );
|
||||||
|
|
||||||
( *aSettings->Internals() )[aNamespace].update( backup );
|
if( backup )
|
||||||
|
( *aSettings->Internals() )[aNamespace].update( *backup );
|
||||||
|
|
||||||
aSettings->Load();
|
aSettings->Load();
|
||||||
|
|
||||||
aSettings->SaveToFile( path, true );
|
aSettings->SaveToFile( path, true );
|
||||||
|
|
Loading…
Reference in New Issue