Skip to content
Permalink
Browse files

Catch when GEOSCoordSeq_create_r returns 0 (should fix crash in #13934)

  • Loading branch information
jef-n committed Dec 3, 2015
1 parent 3755c3b commit cd830c460ab0d13aa4a7b5eda2bf65b920a7e71b
Showing with 10 additions and 0 deletions.
  1. +10 −0 src/core/geometry/qgsgeos.cpp
@@ -1487,6 +1487,11 @@ GEOSCoordSequence* QgsGeos::createCoordinateSequence( const QgsCurveV2* curve, d
try
{
coordSeq = GEOSCoordSeq_create_r( geosinit.ctxt, numPoints, coordDims );
if ( !coordSeq )
{
QgsMessageLog::logMessage( QObject::tr( "Could not create coordinate sequence for %1 points in %2 dimensions" ).arg( numPoints ).arg( coordDims ), QObject::tr( "GEOS" ) );
return 0;
}
if ( precision > 0. )
{
for ( int i = 0; i < numPoints; ++i )
@@ -1542,6 +1547,11 @@ GEOSGeometry* QgsGeos::createGeosPoint( const QgsAbstractGeometryV2* point, int
try
{
GEOSCoordSequence* coordSeq = GEOSCoordSeq_create_r( geosinit.ctxt, 1, coordDims );
if ( !coordSeq )
{
QgsMessageLog::logMessage( QObject::tr( "Could not create coordinate sequence for point with %1 dimensions" ).arg( coordDims ), QObject::tr( "GEOS" ) );
return 0;
}
if ( precision > 0. )
{
GEOSCoordSeq_setX_r( geosinit.ctxt, coordSeq, 0, qgsRound( pt->x() / precision ) * precision );

0 comments on commit cd830c4

Please sign in to comment.
You can’t perform that action at this time.