Skip to content

Commit

Permalink
avoid segfault on failed reprojected point (MapServer#4403)
Browse files Browse the repository at this point in the history
also add proj error message as to why reprojection failed
  • Loading branch information
tbonfort committed Aug 6, 2012
1 parent 3c51b37 commit 62d4a9d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
9 changes: 7 additions & 2 deletions mapgml.c
Expand Up @@ -1215,8 +1215,13 @@ int msGMLWriteQuery(mapObj *map, char *filename, const char *namespaces)

#ifdef USE_PROJ
/* project the shape into the map projection (if necessary), note that this projects the bounds as well */
if(pszOutputSRS == pszMapSRS && msProjectionsDiffer(&(lp->projection), &(map->projection)))
msProjectShape(&lp->projection, &map->projection, &shape);
if(pszOutputSRS == pszMapSRS && msProjectionsDiffer(&(lp->projection), &(map->projection))) {
status = msProjectShape(&lp->projection, &map->projection, &shape);
if(status != MS_SUCCESS) {
msIO_fprintf(stream, "<!-- Warning: Failed to reproject shape: %s -->\n",msGetErrorString(","));
continue;
}
}
#endif

/* start this feature */
Expand Down
4 changes: 3 additions & 1 deletion mapproject.c
Expand Up @@ -114,8 +114,10 @@ int msProjectPoint(projectionObj *in, projectionObj *out, pointObj *point)
msReleaseLock( TLOCK_PROJ );
#endif

if( error || point->x == HUGE_VAL || point->y == HUGE_VAL )
if( error || point->x == HUGE_VAL || point->y == HUGE_VAL ) {
msSetError(MS_PROJERR,"proj says: %s","msProjectPoint()",pj_strerrno(error));
return MS_FAILURE;
}

if( pj_is_latlong(out->proj) ) {
point->x *= RAD_TO_DEG;
Expand Down

0 comments on commit 62d4a9d

Please sign in to comment.