[mapserver-commits] r7181 - trunk/mapserver

svn at osgeo.org svn at osgeo.org
Mon Dec 17 08:59:53 EST 2007


Author: unicoletti
Date: 2007-12-17 08:59:53 -0500 (Mon, 17 Dec 2007)
New Revision: 7181

Modified:
   trunk/mapserver/maplabel.c
Log:
#2347: avoid segfault in msAddLabel when style definition is missing

Modified: trunk/mapserver/maplabel.c
===================================================================
--- trunk/mapserver/maplabel.c	2007-12-17 11:12:16 UTC (rev 7180)
+++ trunk/mapserver/maplabel.c	2007-12-17 13:59:53 UTC (rev 7181)
@@ -165,9 +165,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);
     rect.maxx = rect.minx + (w-1);



More information about the mapserver-commits mailing list