Skip to content

Commit

Permalink
d.linegraph: color count check was off by one
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.osgeo.org/grass/grass/trunk@69666 15284696-431f-4ddb-bdfa-cd5b030d7da7
  • Loading branch information
wenzeslaus committed Oct 3, 2016
1 parent e5e55dc commit 0b1d5a0
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions display/d.linegraph/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -283,10 +283,11 @@ int main(int argc, char **argv)
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;
Expand Down Expand Up @@ -322,6 +323,7 @@ int main(int argc, char **argv)
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);
Expand Down

0 comments on commit 0b1d5a0

Please sign in to comment.