Skip to content

Commit

Permalink
[tiledscene] Catch type error exception when parsing tilesetVersion
Browse files Browse the repository at this point in the history
  • Loading branch information
nirvn authored and nyalldawson committed Jan 5, 2024
1 parent dfd2686 commit e06c8ee
Showing 1 changed file with 18 additions and 4 deletions.
22 changes: 18 additions & 4 deletions src/core/tiledscene/qgscesiumtilesdataprovider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -729,8 +729,15 @@ void QgsCesiumTilesDataProviderSharedData::initialize( const QString &tileset, c
const auto &asset = mTileset[ "asset" ];
if ( asset.contains( "tilesetVersion" ) )
{
const QString tilesetVersion = QString::fromStdString( asset["tilesetVersion"].get<std::string>() );
mLayerMetadata.setIdentifier( tilesetVersion );
try
{
const QString tilesetVersion = QString::fromStdString( asset["tilesetVersion"].get<std::string>() );
mLayerMetadata.setIdentifier( tilesetVersion );
}
catch ( json::type_error & )
{
QgsDebugError( QStringLiteral( "Error when parsing tilesetVersion value" ) );
}
}
}

Expand Down Expand Up @@ -1150,8 +1157,15 @@ QString QgsCesiumTilesDataProvider::htmlMetadata() const

if ( asset.contains( "tilesetVersion" ) )
{
const QString tilesetVersion = QString::fromStdString( asset["tilesetVersion"].get<std::string>() );
metadata += QStringLiteral( "<tr><td class=\"highlight\">" ) % tr( "Tileset Version" ) % QStringLiteral( "</td><td>%1</a>" ).arg( tilesetVersion ) % QStringLiteral( "</td></tr>\n" );
try
{
const QString tilesetVersion = QString::fromStdString( asset["tilesetVersion"].get<std::string>() );
metadata += QStringLiteral( "<tr><td class=\"highlight\">" ) % tr( "Tileset Version" ) % QStringLiteral( "</td><td>%1</a>" ).arg( tilesetVersion ) % QStringLiteral( "</td></tr>\n" );
}
catch ( json::type_error & )
{
QgsDebugError( QStringLiteral( "Error when parsing tilesetVersion value" ) );
}
}

if ( asset.contains( "generator" ) )
Expand Down

0 comments on commit e06c8ee

Please sign in to comment.