Skip to content

Commit

Permalink
Fix for uninitialised variable in interpolator and for possible divis…
Browse files Browse the repository at this point in the history
…ion by zero

git-svn-id: http://svn.osgeo.org/qgis/trunk@11509 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
mhugent committed Aug 26, 2009
1 parent 0467062 commit 1d8d723
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions src/plugins/interpolation/qgsidwinterpolator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@ int QgsIDWInterpolator::interpolatePoint( double x, double y, double& result )
sumDenominator += currentWeight;
}

if ( sumDenominator == 0.0 )
{
return 1;
}

result = sumCounter / sumDenominator;
return 0;
}
2 changes: 1 addition & 1 deletion src/plugins/interpolation/qgsinterpolator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
#define isnan(f) _isnan(f)
#endif

QgsInterpolator::QgsInterpolator( const QList<LayerData>& layerData ): mLayerData( layerData )
QgsInterpolator::QgsInterpolator( const QList<LayerData>& layerData ): mDataIsCached( false ), mLayerData( layerData )
{

}
Expand Down

0 comments on commit 1d8d723

Please sign in to comment.