[GRASS-SVN] r69666 - grass/trunk/display/d.linegraph

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Oct 3 16:14:30 PDT 2016


Author: wenzeslaus
Date: 2016-10-03 16:14:30 -0700 (Mon, 03 Oct 2016)
New Revision: 69666

Modified:
   grass/trunk/display/d.linegraph/main.c
Log:
d.linegraph: color count check was off by one

Modified: grass/trunk/display/d.linegraph/main.c
===================================================================
--- grass/trunk/display/d.linegraph/main.c	2016-10-03 23:06:40 UTC (rev 69665)
+++ grass/trunk/display/d.linegraph/main.c	2016-10-03 23:14:30 UTC (rev 69666)
@@ -283,10 +283,11 @@
 		color_name[c++] = y_color_opt->answer[i];
 	    }
 	}
-	/* this is lame. I could come up with a color or prompt for one or something */
-	if (j < num_y_files)
-	    G_fatal_error(_("Only <%d> colors given for <%d> lines"), j,
-			  num_y_files);
+        /* in theory we could repeat the colors but that may seem random */
+        /* TODO: repeat the colors if only one provided (as with width) */
+        if (j - 1 < num_y_files)
+            G_fatal_error(_("Only <%d> colors given for <%d> lines"),
+                          j - 1, num_y_files);
     }
     else if (color_table_opt->answer) {
         struct Colors colors;
@@ -322,6 +323,7 @@
     if (line_width_opt->answer) {
         i = 0;
         while (line_width_opt->answers[i]) {
+            /* we could relax this and just stop/warn reading as with the colors */
             if (i + 1 > num_y_files)
                 G_fatal_error(_("Number of widths (%d) is higher then"
                                 " the number of files (%d)"), i + 1, num_y_files);



More information about the grass-commit mailing list