Skip to content
Permalink
Browse files

[OAPIF provider] Avoid crash when service description page lacks emai…

…l or url in contact object

Found when investigating OSGeo/gdal#2873
but doesn't address it
  • Loading branch information
rouault authored and nyalldawson committed Aug 22, 2020
1 parent 8496807 commit 4e0f64f40a4154193c7be1ff0a3a3d5bb68afbc0
Showing with 13 additions and 8 deletions.
  1. +13 −8 src/providers/wfs/qgsoapifapirequest.cpp
@@ -131,17 +131,22 @@ void QgsOapifApiRequest::processReply()
if ( name.is_string() )
{
QgsAbstractMetadataBase::Contact contact( QString::fromStdString( name.get<std::string>() ) );
const auto email = jContact["email"];
if ( email.is_string() )
if ( jContact.contains( "email" ) )
{
contact.email = QString::fromStdString( email.get<std::string>() );
const auto email = jContact["email"];
if ( email.is_string() )
{
contact.email = QString::fromStdString( email.get<std::string>() );
}
}

const auto url = jContact["url"];
if ( url.is_string() )
if ( jContact.contains( "url" ) )
{
// A bit of abuse to fill organization with url
contact.organization = QString::fromStdString( url.get<std::string>() );
const auto url = jContact["url"];
if ( url.is_string() )
{
// A bit of abuse to fill organization with url
contact.organization = QString::fromStdString( url.get<std::string>() );
}
}
mMetadata.addContact( contact );
}

0 comments on commit 4e0f64f

Please sign in to comment.
You can’t perform that action at this time.