Skip to content

Commit

Permalink
fixed crash when zooming out so that raster map extent is smaller tha…
Browse files Browse the repository at this point in the history
…n canvas pixel

git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@15760 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
rblazek committed Apr 18, 2011
1 parent be647d0 commit 6939937
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/core/qgsrasterdataprovider.cpp
Expand Up @@ -53,6 +53,9 @@ void QgsRasterDataProvider::readBlock( int bandNo, QgsRectangle const & viewExt

// TODO: init data by nulls

// If we zoom out too much, projector srcRows / srcCols maybe 0, which can cause problems in providers
if ( myProjector.srcRows() <= 0 || myProjector.srcCols() <= 0 ) return;

// Allocate memory for not projected source data
int mySize = dataTypeSize( bandNo ) / 8;
void *mySrcData = malloc( mySize * myProjector.srcRows() * myProjector.srcCols() );
Expand Down
2 changes: 2 additions & 0 deletions src/providers/grass/qgsgrassrasterprovider.cpp
Expand Up @@ -211,6 +211,8 @@ void QgsGrassRasterProvider::readBlock( int bandNo, QgsRectangle const & viewEx
QgsDebugMsg( "pixelHeight = " + QString::number( pixelHeight ) );
QgsDebugMsg( "viewExtent: " + viewExtent.toString() );

if ( pixelWidth <= 0 || pixelHeight <= 0 ) return;

QStringList arguments;
arguments.append( "map=" + mMapName + "@" + mMapset );

Expand Down

0 comments on commit 6939937

Please sign in to comment.