Handle exception when JSON datatype mismatches

Fixes #4031
This commit is contained in:
Jon Evans 2020-03-09 14:05:34 -04:00
parent f079c41118
commit 2662b06099
1 changed files with 9 additions and 1 deletions

View File

@ -105,7 +105,15 @@ public:
OPT<ValueType> Get( std::string aPath ) const
{
if( OPT<nlohmann::json> ret = GetJson( std::move( aPath ) ) )
return ret->get<ValueType>();
{
try
{
return ret->get<ValueType>();
}
catch( ... )
{
}
}
return NULLOPT;
}