Skip to content
Permalink
Browse files
fixed crash when zooming out so that raster map extent is smaller tha…
…n canvas pixel

git-svn-id: http://svn.osgeo.org/qgis/trunk@15760 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
rblazek committed Apr 18, 2011
1 parent 9e244e8 commit 37ee3cb81237cbbf3a04dff79bb3a30d7d946d8e
Showing with 5 additions and 0 deletions.
  1. +3 −0 src/core/qgsrasterdataprovider.cpp
  2. +2 −0 src/providers/grass/qgsgrassrasterprovider.cpp
@@ -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() );
@@ -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 );

0 comments on commit 37ee3cb

Please sign in to comment.