[mapserver-commits] r7332 - branches/branch-5-0/mapserver

svn at osgeo.org svn at osgeo.org
Wed Jan 30 17:17:23 EST 2008


Author: tamas
Date: 2008-01-30 17:17:23 -0500 (Wed, 30 Jan 2008)
New Revision: 7332

Modified:
   branches/branch-5-0/mapserver/maplabel.c
Log:
fix segfault in mapserv if STYLE is not definied (#2347)

Modified: branches/branch-5-0/mapserver/maplabel.c
===================================================================
--- branches/branch-5-0/mapserver/maplabel.c	2008-01-30 19:59:35 UTC (rev 7331)
+++ branches/branch-5-0/mapserver/maplabel.c	2008-01-30 22:17:23 UTC (rev 7332)
@@ -153,8 +153,14 @@
     msInitShape(cacheslot->markers[i].poly);
 
     /* TO DO: at the moment only checks the bottom style, perhaps should check all of them */
-    if(msGetMarkerSize(&map->symbolset, classPtr->styles[0], &w, &h, layerPtr->scalefactor) != MS_SUCCESS)
-      return(MS_FAILURE);
+    /* #2347: after RFC-24 classPtr->styles could be NULL so we check it */
+    if (classPtr->styles != NULL) {
+	    if(msGetMarkerSize(&map->symbolset, classPtr->styles[0], &w, &h, layerPtr->scalefactor) != MS_SUCCESS)
+    	  return(MS_FAILURE);
+    } else {
+    	msSetError(MS_MISCERR, "msAddLabel error: missing style definition for layer '%s'", "msAddLabel()", layerPtr->name);
+		return(MS_FAILURE);
+	}
 
     rect.minx = MS_NINT(point->x - .5 * w);
     rect.miny = MS_NINT(point->y - .5 * h);



More information about the mapserver-commits mailing list