Fixing a problem if JSON node does not exist

parent 7a62cf58
......@@ -195,9 +195,12 @@ void ITAGeo::CEmitter::LoadFromJSONString( const std::string& sContent, std::sha
//Set the orientation
qOrient.SetValues( dOrientation );
std::string sDirectivityID = jnRoot.at( "directivity_id" ).as_string();
if( pResourceManager && pResourceManager->HasDirectivity( sDirectivityID ) )
pDirectivity = pResourceManager->GetDirectivity( sDirectivityID );
if( jnRoot.find( "directivity_id" ) != jnRoot.end() )
{
std::string sDirectivityID = jnRoot.at( "directivity_id" ).as_string();
if( pResourceManager && pResourceManager->HasDirectivity( sDirectivityID ) )
pDirectivity = pResourceManager->GetDirectivity( sDirectivityID );
}
#endif
}
......@@ -304,9 +307,13 @@ void ITAGeo::CSensor::LoadFromJSONString( const std::string& sContent, std::shar
//Set the orientation
qOrient.SetValues( dOrientation );
std::string sDirectivityID = ( std::string ) jnRoot.at( "directivity_id" ).as_string();
if( pResourceManager->HasDirectivity( sDirectivityID ) )
pDirectivity = pResourceManager->GetDirectivity( sDirectivityID );
if( jnRoot.find( "directivity_id" ) != jnRoot.end() )
{
std::string sDirectivityID = ( std::string ) jnRoot.at( "directivity_id" ).as_string();
if( pResourceManager->HasDirectivity( sDirectivityID ) )
pDirectivity = pResourceManager->GetDirectivity( sDirectivityID );
}
#endif
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment