[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 2/3] Don't attempt to do terminal functions on non-functional gfx
From: |
Vladimir Serbinenko |
Subject: |
[PATCH 2/3] Don't attempt to do terminal functions on non-functional gfxterm |
Date: |
Thu, 16 May 2024 22:34:43 +0300 |
Attempting to do anything easily leads to a crash
Signed-off-by: Vladimir Serbinenko <phcoder@gmail.com>
---
grub-core/term/gfxterm.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/grub-core/term/gfxterm.c b/grub-core/term/gfxterm.c
index e8734a388..6513a529b 100644
--- a/grub-core/term/gfxterm.c
+++ b/grub-core/term/gfxterm.c
@@ -1038,6 +1038,9 @@ static void
grub_gfxterm_gotoxy (struct grub_term_output *term __attribute__ ((unused)),
struct grub_term_coordinate pos)
{
+ if (!virtual_screen.functional)
+ return;
+
if (pos.x >= virtual_screen.columns)
pos.x = virtual_screen.columns - 1;
@@ -1072,6 +1075,9 @@ grub_gfxterm_cls (struct grub_term_output *term)
{
grub_video_color_t color;
+ if (!virtual_screen.functional)
+ return;
+
/* Clear virtual screen. */
grub_virtual_screen_cls (term);
@@ -1118,6 +1124,9 @@ static void
grub_gfxterm_setcursor (struct grub_term_output *term __attribute__ ((unused)),
int on)
{
+ if (!virtual_screen.functional)
+ return;
+
if (virtual_screen.cursor_state != on)
{
if (virtual_screen.cursor_state)
@@ -1132,6 +1141,9 @@ grub_gfxterm_setcursor (struct grub_term_output *term
__attribute__ ((unused)),
static void
grub_gfxterm_refresh (struct grub_term_output *term __attribute__ ((unused)))
{
+ if (!virtual_screen.functional)
+ return;
+
real_scroll ();
/* Redraw only changed regions. */
--
2.39.2