Skip migration if target key is missing

Fixes https://gitlab.com/kicad/code/kicad/-/issues/5536
This commit is contained in:
Jon Evans 2020-09-07 11:43:12 -04:00
parent d60b5a0618
commit d6be0be177
1 changed files with 6 additions and 3 deletions

View File

@ -422,13 +422,16 @@ bool FOOTPRINT_EDITOR_SETTINGS::migrateSchema0to1()
if( !m_manager )
{
wxLogTrace(
traceSettings, "Error: FOOTPRINT_EDITOR_SETTINGS migration cannot run unmanaged!" );
wxLogTrace( traceSettings,
"Error: FOOTPRINT_EDITOR_SETTINGS migration cannot run unmanaged!" );
return false;
}
nlohmann::json::json_pointer theme_ptr( "/appearance/color_theme" );
if( !count( theme_ptr ) )
return true;
wxString selected = at( theme_ptr ).get<wxString>();
wxString search = selected + wxT( "_footprints" );
@ -437,7 +440,7 @@ bool FOOTPRINT_EDITOR_SETTINGS::migrateSchema0to1()
if( settings->GetFilename() == search )
{
wxLogTrace( traceSettings, "Updating footprint editor theme from %s to %s",
selected, search );
selected, search );
( *this )[theme_ptr] = search;
return true;
}