diff options
| author | Burt P <pburt0@gmail.com> | 2017-12-09 13:31:38 -0600 | 
|---|---|---|
| committer | Leandro A. F. Pereira <leandro@hardinfo.org> | 2017-12-09 12:09:50 -0800 | 
| commit | 96980fbf494d9c453c6b558967c90c55e41abe2d (patch) | |
| tree | fd7159ecca4972529d5a09c46cb3b1e476e8b5bd /shell | |
| parent | b5b0810cc60d2d266b72b50ba98136ae2bab3b84 (diff) | |
report.c: don't try to use colum values that weren't provided
Signed-off-by: Burt P <pburt0@gmail.com>
Diffstat (limited to 'shell')
| -rw-r--r-- | shell/report.c | 5 | 
1 files changed, 3 insertions, 2 deletions
| diff --git a/shell/report.c b/shell/report.c index 135dfd9b..e59b00d4 100644 --- a/shell/report.c +++ b/shell/report.c @@ -371,7 +371,7 @@ report_text_key_value(ReportContext * ctx, gchar * key, gchar * value)  {      gint columns = report_get_visible_columns(ctx);      gchar **values; -    gint i; +    gint i, mc;      if (columns == 2) {        if (strlen(value)) @@ -380,10 +380,11 @@ report_text_key_value(ReportContext * ctx, gchar * key, gchar * value)            ctx->output = h_strdup_cprintf("%s\n", ctx->output, key);      } else {        values = g_strsplit(value, "|", columns); +      mc = g_strv_length(values) - 1;        ctx->output = h_strdup_cprintf("%s\t", ctx->output, key); -      for (i = columns - 2; i >= 0; i--) { +      for (i = mc; i >= 0; i--) {          ctx->output = h_strdup_cprintf("%s\t",                                         ctx->output,                                         values[i]); | 
