Skip to content

Commit

Permalink
skip raster nuller with color types; check data block allocation in b…
Browse files Browse the repository at this point in the history
…lock value read, fixes possibly #7807
  • Loading branch information
blazek committed May 14, 2013
1 parent 4ac52cf commit c0dec5a
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
5 changes: 5 additions & 0 deletions src/core/raster/qgsrasterblock.h
Expand Up @@ -443,6 +443,11 @@ inline void QgsRasterBlock::writeValue( void *data, QGis::DataType type, size_t

inline double QgsRasterBlock::value( size_t index ) const
{
if ( !mData )
{
QgsDebugMsg( "Data block not allocated" );
return std::numeric_limits<double>::quiet_NaN();
}
return readValue( mData, mDataType, index );
}

Expand Down
14 changes: 12 additions & 2 deletions src/core/raster/qgsrasternuller.cpp
Expand Up @@ -74,11 +74,21 @@ QgsRasterBlock * QgsRasterNuller::block( int bandNo, QgsRectangle const & exten
QgsDebugMsg( "Entered" );
if ( !mInput )
{
QgsRasterBlock *outputBlock = new QgsRasterBlock();
return outputBlock;
return new QgsRasterBlock();
}

QgsRasterBlock *inputBlock = mInput->block( bandNo, extent, width, height );
if ( !inputBlock )
{
return new QgsRasterBlock();
}

// We don't support nuller for color types
if ( QgsRasterBlock::typeIsColor( inputBlock->dataType() ) )
{
return inputBlock;
}

QgsRasterBlock *outputBlock = 0;

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

0 comments on commit c0dec5a

Please sign in to comment.