[mapserver-commits] r11366 - trunk/mapserver

svn at osgeo.org svn at osgeo.org
Tue Mar 29 14:26:43 EDT 2011


Author: warmerdam
Date: 2011-03-29 11:26:43 -0700 (Tue, 29 Mar 2011)
New Revision: 11366

Modified:
   trunk/mapserver/shp2img.c
Log:
Make less sensitive to missing commandline arguments triggering crashes.


Modified: trunk/mapserver/shp2img.c
===================================================================
--- trunk/mapserver/shp2img.c	2011-03-29 16:08:43 UTC (rev 11365)
+++ trunk/mapserver/shp2img.c	2011-03-29 18:26:43 UTC (rev 11366)
@@ -56,7 +56,7 @@
       continue;
     }
 
-    if(strcmp(argv[i], "-all_debug") == 0) /* global debug */
+    if(strcmp(argv[i], "-all_debug") == 0 && i < argc-1 ) /* global debug */
     {
         int debug_level = atoi(argv[++i]);
 
@@ -193,7 +193,7 @@
       i+=2;
     }
 
-    if(strcmp(argv[i], "-all_debug") == 0) /* global debug */
+    if(strcmp(argv[i], "-all_debug") == 0 && i < argc-1 ) /* global debug */
     {
         int debug_level = atoi(argv[++i]);
 
@@ -207,7 +207,7 @@
 
     }
     
-    if(strcmp(argv[i], "-map_debug") == 0) /* debug */
+    if(strcmp(argv[i], "-map_debug") == 0 && i < argc-1 ) /* debug */
     {
         map->debug = atoi(argv[++i]);
 
@@ -216,7 +216,7 @@
             msSetErrorFile("stderr", NULL);
     }
     
-    if(strcmp(argv[i], "-layer_debug") == 0) /* debug */
+    if(strcmp(argv[i], "-layer_debug") == 0 && i < argc-1 ) /* debug */
     {
         const char *layer_name = argv[++i];
         int debug_level = atoi(argv[++i]);



More information about the mapserver-commits mailing list