Do not crash if PARAM_LIST backing data contains unexpected type

This commit is contained in:
Jon Evans 2023-08-30 14:31:12 -04:00
parent b8a61719c3
commit 1a8fcdfdd7
1 changed files with 10 additions and 1 deletions

View File

@ -121,7 +121,16 @@ bool PARAM_LIST<ValueType>::MatchesFile( JSON_SETTINGS* aSettings ) const
std::vector<ValueType> val;
for( const auto& el : js->items() )
val.emplace_back( el.value().get<ValueType>() );
{
try
{
val.emplace_back( el.value().get<ValueType>() );
}
catch( ... )
{
// Probably typecast didn't work; skip this element
}
}
return val == *m_ptr;
}