From: Ray Strode Date: Thu, 28 Dec 2023 14:31:08 +0000 (-0500) Subject: fade-throbber: Be more tolerant when there's no console viewer X-Git-Tag: 24.004.60~18^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6359b6715ed89d84e5c8066236f233a18ef790ef;p=thirdparty%2Fplymouth.git fade-throbber: Be more tolerant when there's no console viewer There are still a number of places in the code where a console viewer is expected, when it's totally possible that there won't be one. This commit runs through them, and does a few other style cleanups on the way. --- diff --git a/src/plugins/splash/fade-throbber/plugin.c b/src/plugins/splash/fade-throbber/plugin.c index 1d0a6e82..44729a07 100644 --- a/src/plugins/splash/fade-throbber/plugin.c +++ b/src/plugins/splash/fade-throbber/plugin.c @@ -209,10 +209,12 @@ view_hide_prompt (view_t *view) plugin = view->plugin; /* Obscure the password length in the scroll back */ - if (plugin->state == PLY_BOOT_SPLASH_DISPLAY_PASSWORD_ENTRY) - ply_console_viewer_clear_line (view->console_viewer); + if (view->console_viewer != NULL) { + if (plugin->state == PLY_BOOT_SPLASH_DISPLAY_PASSWORD_ENTRY) + ply_console_viewer_clear_line (view->console_viewer); - ply_console_viewer_print (view->console_viewer, "\n"); + ply_console_viewer_print (view->console_viewer, "\n"); + } if (ply_entry_is_hidden (view->entry)) return; @@ -350,8 +352,7 @@ view_free (view_t *view) ply_label_free (view->message_label); free_stars (view); - if (view->console_viewer) - ply_console_viewer_free (view->console_viewer); + ply_console_viewer_free (view->console_viewer); ply_pixel_display_set_draw_handler (view->display, NULL, NULL); @@ -850,9 +851,8 @@ on_draw (view_t *view, x, y, width, height); } - if (plugin->plugin_console_messages_updating == false && view->console_viewer) { + if (!plugin->plugin_console_messages_updating && view->console_viewer != NULL) ply_console_viewer_draw_area (view->console_viewer, pixel_buffer, x, y, width, height); - } } static void @@ -926,7 +926,8 @@ show_splash_screen (ply_boot_splash_plugin_t *plugin, view = ply_list_node_get_data (node); next_node = ply_list_get_next_node (plugin->views, node); - ply_console_viewer_convert_boot_buffer (view->console_viewer, plugin->boot_buffer); + if (view->console_viewer != NULL) + ply_console_viewer_convert_boot_buffer (view->console_viewer, plugin->boot_buffer); node = next_node; } @@ -1081,7 +1082,8 @@ show_message (ply_boot_splash_plugin_t *plugin, ply_label_get_height (view->message_label)); - ply_console_viewer_print (view->console_viewer, "\n%s\n", message); + if (view->console_viewer != NULL) + ply_console_viewer_print (view->console_viewer, "\n%s\n", message); node = next_node; } }