diff --git a/glnx-console.c b/glnx-console.c
index 416d2768113d671ae78611f89a9b217bf99bad80..cf5409c91da2b4d0cc1670d1ad40c4011ad5a5ca 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;