walters / rpms / plymouth

Forked from rpms/plymouth 6 years ago
Clone
Blob Blame History Raw
commit 5534d814aac9a7e7d975670653fc7f89701cff68
Author: Ray Strode <rstrode@redhat.com>
Date:   Wed Aug 27 14:08:12 2008 -0400

    Don't try to print prompt in text plugin, if there is not prompt
    
    Fixes a crasher.

diff --git a/src/plugins/splash/text/plugin.c b/src/plugins/splash/text/plugin.c
index 8800122..11c2dc4 100644
--- a/src/plugins/splash/text/plugin.c
+++ b/src/plugins/splash/text/plugin.c
@@ -294,10 +294,13 @@ ask_for_password (ply_boot_splash_plugin_t *plugin,
   window_width = ply_window_get_number_of_text_columns (plugin->window);
   window_height = ply_window_get_number_of_text_rows (plugin->window);
 
-  ply_window_set_text_cursor_position (plugin->window,
-                                       window_width / 2 - strlen (prompt) / 2,
-                                       window_height / 2 - 1);
-  write (STDOUT_FILENO, prompt, strlen (prompt));
+  if (prompt != NULL)
+    {
+      ply_window_set_text_cursor_position (plugin->window,
+                                           window_width / 2 - strlen (prompt) / 2,
+                                           window_height / 2 - 1);
+      write (STDOUT_FILENO, prompt, strlen (prompt));
+    }
   ply_window_set_text_cursor_position (plugin->window,
                                        window_width / 2 - strlen ("Password:        "),
                                        window_height / 2);