Skip to content

Commit c0dec5a

Browse files
committedMay 14, 2013
skip raster nuller with color types; check data block allocation in block value read, fixes possibly #7807
1 parent 4ac52cf commit c0dec5a

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed
 

‎src/core/raster/qgsrasterblock.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -443,6 +443,11 @@ inline void QgsRasterBlock::writeValue( void *data, QGis::DataType type, size_t
443443

444444
inline double QgsRasterBlock::value( size_t index ) const
445445
{
446+
if ( !mData )
447+
{
448+
QgsDebugMsg( "Data block not allocated" );
449+
return std::numeric_limits<double>::quiet_NaN();
450+
}
446451
return readValue( mData, mDataType, index );
447452
}
448453

‎src/core/raster/qgsrasternuller.cpp

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,21 @@ QgsRasterBlock * QgsRasterNuller::block( int bandNo, QgsRectangle const & exten
7474
QgsDebugMsg( "Entered" );
7575
if ( !mInput )
7676
{
77-
QgsRasterBlock *outputBlock = new QgsRasterBlock();
78-
return outputBlock;
77+
return new QgsRasterBlock();
7978
}
8079

8180
QgsRasterBlock *inputBlock = mInput->block( bandNo, extent, width, height );
81+
if ( !inputBlock )
82+
{
83+
return new QgsRasterBlock();
84+
}
85+
86+
// We don't support nuller for color types
87+
if ( QgsRasterBlock::typeIsColor( inputBlock->dataType() ) )
88+
{
89+
return inputBlock;
90+
}
91+
8292
QgsRasterBlock *outputBlock = 0;
8393

8494
if ( mHasOutputNoData.value( bandNo - 1 ) || inputBlock->hasNoDataValue() )

0 commit comments

Comments
 (0)
Please sign in to comment.