[GRASS-SVN] r47868 - grass/trunk/vector/v.colors.out

svn_grass at osgeo.org svn_grass at osgeo.org
Wed Aug 24 08:25:23 EDT 2011


Author: martinl
Date: 2011-08-24 05:25:23 -0700 (Wed, 24 Aug 2011)
New Revision: 47868

Modified:
   grass/trunk/vector/v.colors.out/main.c
Log:
v.colors.out: check if color table is defined


Modified: grass/trunk/vector/v.colors.out/main.c
===================================================================
--- grass/trunk/vector/v.colors.out/main.c	2011-08-24 11:00:24 UTC (rev 47867)
+++ grass/trunk/vector/v.colors.out/main.c	2011-08-24 12:25:23 UTC (rev 47868)
@@ -37,6 +37,7 @@
     } flag;
     struct Colors cat_colors, *colors;
     
+    int ret;
     int min, max;
     const char *file, *name, *layer, *column;
     FILE *fp;
@@ -78,10 +79,16 @@
     file = opt.file->answer;
     column = opt.col->answer;
     
-    if (Vect_read_colors(name, "", &cat_colors) < 0)
+    ret = Vect_read_colors(name, "", &cat_colors);
+    if (ret < 0)
 	G_fatal_error(_("Unable to read color table for vector map <%s>"),
 		      opt.map->answer);
-    
+    if (ret == 0) {
+	G_warning(_("No color table defined for vector map <%s>"),
+		  opt.map->answer);
+	exit(EXIT_SUCCESS);
+    }
+
     min = max = -1;
     if (flag.p->answer) {
 	scan_cats(name, layer, &min, &max);



More information about the grass-commit mailing list