Skip to content
Permalink
Browse files

Fix crashes when attempting to export reprojected raster layers

  • Loading branch information
github-actions authored and nirvn committed Jan 19, 2020
1 parent 63fb2df commit 2fff8e1205daffafa257b9312cc2c005b5e3017e
Showing with 7 additions and 1 deletion.
  1. +7 −1 src/core/raster/qgsrasterfilewriter.cpp
@@ -523,6 +523,9 @@ QgsRasterFileWriter::WriterError QgsRasterFileWriter::writeDataRaster( const Qgs
{
partDestProvider->setNoDataValue( i, destNoDataValueList.value( i - 1 ) );
}
if ( destBlockList[ i - 1 ]->isEmpty() )
continue;

if ( !partDestProvider->write( destBlockList[i - 1]->bits( 0 ), i, iterCols, iterRows, 0, 0 ) )
{
return WriteError;
@@ -536,6 +539,9 @@ QgsRasterFileWriter::WriterError QgsRasterFileWriter::writeDataRaster( const Qgs
//loop over data
for ( int i = 1; i <= nBands; ++i )
{
if ( destBlockList[ i - 1 ]->isEmpty() )
continue;

if ( !destProvider->write( destBlockList[i - 1]->bits( 0 ), i, iterCols, iterRows, iterLeft, iterTop ) )
{
return WriteError;
@@ -643,7 +649,7 @@ QgsRasterFileWriter::WriterError QgsRasterFileWriter::writeImageRaster( QgsRaste
std::unique_ptr< QgsRasterBlock > inputBlock;
while ( iter->readNextRasterPart( 1, iterCols, iterRows, inputBlock, iterLeft, iterTop ) )
{
if ( !inputBlock )
if ( !inputBlock || inputBlock->isEmpty() )
{
continue;
}

0 comments on commit 2fff8e1

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