Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
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 cd830c4
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/core/geometry/qgsgeos.cpp
Expand Up @@ -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 )
Expand Down Expand Up @@ -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 );
Expand Down

0 comments on commit cd830c4

Please sign in to comment.