From 29ad99c9b6103853e6d6bf42fa7bff335eb114a8 Mon Sep 17 00:00:00 2001
From: Colin Walters <walters@verbum.org>
Date: Tue, 1 Aug 2017 14:25:40 -0400
Subject: [PATCH] console: Fix Coverity NULL deref warning

We need to handle our "empty to NULL canonicalization" before
doing the length.

Coverity CID: 1376570
---
 glnx-console.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/glnx-console.c b/glnx-console.c
index 416d27681..cf5409c91 100644
--- a/glnx-console.c
+++ b/glnx-console.c
@@ -187,11 +187,12 @@ text_percent_internal (const char *text,
   const guint n_spaces = sizeof (spaces) - 1;
   const guint ncolumns = glnx_console_columns ();
   const guint bar_min = 10;
-  const guint input_textlen = text ? strlen (text) : 0;
 
   if (text && !*text)
     text = NULL;
 
+  const guint input_textlen = text ? strlen (text) : 0;
+
   if (percentage == current_percent
       && g_strcmp0 (text, current_text) == 0)
     return;
-- 
GitLab