summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorColin Walters <walters@verbum.org>2021-06-28 10:05:09 -0400
committerColin Walters <walters@verbum.org>2021-06-28 10:05:09 -0400
commit62f8ed6c8ef489201a19f1e28656c58b363ba851 (patch)
tree15c91e11cb252420ad67b0ebd5619c818de94ab4
parent4c9055ac08bb64dca146724f488cce4c1ce4c628 (diff)
downloadlibglnx-62f8ed6c8ef489201a19f1e28656c58b363ba851.tar.gz
console: Pacify `gcc -fanalyzer`
It's not smart enough to follow the conditionals here to see that `textlen > 0` implies `text != NULL`. But the cost of an additional check is probably nil, so let's be robust to future code refactoring.
-rw-r--r--glnx-console.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/glnx-console.c b/glnx-console.c
index c2fe29d..0a96cdc 100644
--- a/glnx-console.c
+++ b/glnx-console.c
@@ -261,7 +261,7 @@ text_percent_internal (const char *text,
const guint textlen = MIN (input_textlen, ncolumns - bar_min);
const guint barlen = MIN (MAX_PROGRESSBAR_COLUMNS, ncolumns - (textlen + 1));
- if (textlen > 0)
+ if (text && textlen > 0)
{
fwrite (text, 1, textlen, stdout);
fputc (' ', stdout);