Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix #4088: better handling of unknown geometry types
  • Loading branch information
wonder-sk committed Jul 19, 2011
1 parent 49726d2 commit 8e08c53
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/core/pal/internalexception.h
Expand Up @@ -81,7 +81,7 @@ namespace pal
{
const char* what() const throw()
{
return "Geometry Type is unknow";
return "Geometry Type is unknown";
}
};

Expand Down
8 changes: 8 additions & 0 deletions src/core/pal/layer.cpp
Expand Up @@ -262,6 +262,11 @@ namespace pal

// break the (possibly multi-part) geometry into simple geometries
LinkedList <const GEOSGeometry*> *simpleGeometries = unmulti( the_geom );
if ( simpleGeometries == NULL ) // unmulti() failed?
{
modMutex->unlock();
throw InternalException::UnknownGeometry();
}

while ( simpleGeometries->size() > 0 )
{
Expand All @@ -277,7 +282,10 @@ namespace pal
int type = GEOSGeomTypeId( geom );

if ( type != GEOS_POINT && type != GEOS_LINESTRING && type != GEOS_POLYGON )
{
modMutex->unlock();
throw InternalException::UnknownGeometry();
}

FeaturePart* fpart = new FeaturePart( f, geom );

Expand Down
3 changes: 2 additions & 1 deletion src/core/pal/util.cpp
Expand Up @@ -231,7 +231,8 @@ namespace pal
final_queue->push_back( geom );
break;
default:
throw InternalException::UnknownGeometry();
delete final_queue;
final_queue = NULL;
}
}
delete queue;
Expand Down

0 comments on commit 8e08c53

Please sign in to comment.