From 6bc582266cda64d5870cca3cc45fb0b95c5ee33a Mon Sep 17 00:00:00 2001 From: Burt P Date: Wed, 21 Feb 2018 21:45:23 -0600 Subject: report.c: don't try to use column values that weren't provided (html version) Like 96980fbf494d9c453c6b558967c90c55e41abe2d, but the html version of that function. Fixes https://github.com/lpereira/hardinfo/issues/217 Signed-off-by: Burt P --- shell/report.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'shell') diff --git a/shell/report.c b/shell/report.c index e59b00d4..6abb03a0 100644 --- a/shell/report.c +++ b/shell/report.c @@ -300,7 +300,7 @@ report_html_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) { ctx->output = h_strdup_cprintf("%s" @@ -309,10 +309,11 @@ report_html_key_value(ReportContext * ctx, gchar * key, gchar * value) key, value); } else { values = g_strsplit(value, "|", columns); + mc = g_strv_length(values) - 1; ctx->output = h_strdup_cprintf("\n\n%s", ctx->output, key); - for (i = columns - 2; i >= 0; i--) { + for (i = mc; i >= 0; i--) { ctx->output = h_strdup_cprintf("%s", ctx->output, values[i]); -- cgit v1.2.3