Skip to content
Permalink
Browse files

Catch GEOS exceptions when reshape tool is used on non-closed-linestring

And use qWarning() instead of QgsDebugMsg() to make tracing GEOS errors easier
because a stack trace is printed.
  • Loading branch information
m-kuhn committed Oct 21, 2014
1 parent 58c34ae commit 37f1a16ce9e0adb6476df3111ca97f8783affccd
Showing with 12 additions and 2 deletions.
  1. +12 −2 src/core/qgsgeometry.cpp
@@ -32,6 +32,8 @@ email : morb at ozemail dot com dot au
#include "qgsmessagelog.h"
#include "qgsgeometryvalidator.h"

#include <QDebug>

#ifndef Q_WS_WIN
#include <netinet/in.h>
#else
@@ -96,7 +98,7 @@ static void throwGEOSException( const char *fmt, ... )
vsnprintf( buffer, sizeof buffer, fmt, ap );
va_end( ap );

QgsDebugMsg( QString( "GEOS exception: %1" ).arg( buffer ) );
qWarning() << QString( "GEOS exception: %1" ).arg( buffer );

throw GEOSException( QString::fromUtf8( buffer ) );
}
@@ -4877,7 +4879,15 @@ GEOSGeometry* QgsGeometry::reshapePolygon( const GEOSGeometry* polygon, const GE

GEOSGeom_destroy_r( geosinit.ctxt, reshapeResult );

newRing = GEOSGeom_createLinearRing_r( geosinit.ctxt, newCoordSequence );
try
{
newRing = GEOSGeom_createLinearRing_r( geosinit.ctxt, newCoordSequence );
}
catch ( GEOSException &e )
{
QgsMessageLog::logMessage( QObject::tr( "Exception: %1" ).arg( e.what() ), QObject::tr( "GEOS" ) );
}

if ( !newRing )
{
delete [] innerRings;

0 comments on commit 37f1a16

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