Don't stop migrating JSON_SETTINGS if intermediate migrator missing

This commit is contained in:
JamesJCode 2024-05-05 14:22:42 +01:00
parent 10aec91075
commit 39d9aba576
1 changed files with 16 additions and 14 deletions

View File

@ -678,23 +678,25 @@ bool JSON_SETTINGS::Migrate()
{
wxLogTrace( traceSettings, wxT( "Migrator missing for %s version %d!" ),
typeid( *this ).name(), filever );
return false;
}
std::pair<int, std::function<bool()>> pair = m_migrators.at( filever );
if( pair.second() )
{
wxLogTrace( traceSettings, wxT( "Migrated %s from %d to %d" ), typeid( *this ).name(),
filever, pair.first );
filever = pair.first;
m_internals->At( "meta.version" ) = filever;
filever++;
}
else
{
wxLogTrace( traceSettings, wxT( "Migration failed for %s from %d to %d" ),
typeid( *this ).name(), filever, pair.first );
return false;
std::pair<int, std::function<bool()>> pair = m_migrators.at( filever );
if( pair.second() )
{
wxLogTrace( traceSettings, wxT( "Migrated %s from %d to %d" ),
typeid( *this ).name(), filever, pair.first );
filever = pair.first;
m_internals->At( "meta.version" ) = filever;
}
else
{
wxLogTrace( traceSettings, wxT( "Migration failed for %s from %d to %d" ),
typeid( *this ).name(), filever, pair.first );
return false;
}
}
}