Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Don't try to read tiles with zero size from vtpk archives
Avoids unnecessary user-visible warnings about unreadable tiles
when those tiles don't actually exist
  • Loading branch information
nyalldawson committed May 9, 2023
1 parent cfe09ee commit 87d3501
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/core/vectortile/qgsvtpktiles.cpp
Expand Up @@ -20,7 +20,6 @@
#include "qgsmessagelog.h"
#include "qgsjsonutils.h"
#include "qgsarcgisrestutils.h"
#include "qgsmbtiles.h"
#include "qgsziputils.h"
#include "qgslayermetadata.h"

Expand Down Expand Up @@ -417,9 +416,8 @@ QByteArray QgsVtpkTiles::tileData( int z, int x, int y )

const std::size_t tileOffset = indexValue % ( 2ULL << 39 );
const std::size_t tileSize = static_cast< std::size_t>( std::floor( indexValue / ( 2ULL << 39 ) ) );

// bundle is a gzip file;
if ( !QgsZipUtils::decodeGzip( buf.get() + tileOffset, tileSize, res ) )
if ( tileSize > 0 && !QgsZipUtils::decodeGzip( buf.get() + tileOffset, tileSize, res ) )
{
QgsMessageLog::logMessage( QObject::tr( "Error extracting bundle contents as gzip: %1" ).arg( fileName ) );
}
Expand Down

0 comments on commit 87d3501

Please sign in to comment.