Skip to content

Commit 6939937

Browse files
author
rblazek
committed
fixed crash when zooming out so that raster map extent is smaller than canvas pixel
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@15760 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent be647d0 commit 6939937

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

src/core/qgsrasterdataprovider.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,9 @@ void QgsRasterDataProvider::readBlock( int bandNo, QgsRectangle const & viewExt
5353

5454
// TODO: init data by nulls
5555

56+
// If we zoom out too much, projector srcRows / srcCols maybe 0, which can cause problems in providers
57+
if ( myProjector.srcRows() <= 0 || myProjector.srcCols() <= 0 ) return;
58+
5659
// Allocate memory for not projected source data
5760
int mySize = dataTypeSize( bandNo ) / 8;
5861
void *mySrcData = malloc( mySize * myProjector.srcRows() * myProjector.srcCols() );

src/providers/grass/qgsgrassrasterprovider.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,8 @@ void QgsGrassRasterProvider::readBlock( int bandNo, QgsRectangle const & viewEx
211211
QgsDebugMsg( "pixelHeight = " + QString::number( pixelHeight ) );
212212
QgsDebugMsg( "viewExtent: " + viewExtent.toString() );
213213

214+
if ( pixelWidth <= 0 || pixelHeight <= 0 ) return;
215+
214216
QStringList arguments;
215217
arguments.append( "map=" + mMapName + "@" + mMapset );
216218

0 commit comments

Comments
 (0)