Skip to content

Commit cd830c4

Browse files
committedDec 3, 2015
Catch when GEOSCoordSeq_create_r returns 0 (should fix crash in #13934)
1 parent 3755c3b commit cd830c4

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed
 

‎src/core/geometry/qgsgeos.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1487,6 +1487,11 @@ GEOSCoordSequence* QgsGeos::createCoordinateSequence( const QgsCurveV2* curve, d
14871487
try
14881488
{
14891489
coordSeq = GEOSCoordSeq_create_r( geosinit.ctxt, numPoints, coordDims );
1490+
if ( !coordSeq )
1491+
{
1492+
QgsMessageLog::logMessage( QObject::tr( "Could not create coordinate sequence for %1 points in %2 dimensions" ).arg( numPoints ).arg( coordDims ), QObject::tr( "GEOS" ) );
1493+
return 0;
1494+
}
14901495
if ( precision > 0. )
14911496
{
14921497
for ( int i = 0; i < numPoints; ++i )
@@ -1542,6 +1547,11 @@ GEOSGeometry* QgsGeos::createGeosPoint( const QgsAbstractGeometryV2* point, int
15421547
try
15431548
{
15441549
GEOSCoordSequence* coordSeq = GEOSCoordSeq_create_r( geosinit.ctxt, 1, coordDims );
1550+
if ( !coordSeq )
1551+
{
1552+
QgsMessageLog::logMessage( QObject::tr( "Could not create coordinate sequence for point with %1 dimensions" ).arg( coordDims ), QObject::tr( "GEOS" ) );
1553+
return 0;
1554+
}
15451555
if ( precision > 0. )
15461556
{
15471557
GEOSCoordSeq_setX_r( geosinit.ctxt, coordSeq, 0, qgsRound( pt->x() / precision ) * precision );

0 commit comments

Comments
 (0)
Please sign in to comment.