qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PULL 01/11] vga: avoid crash if no default vga card


From: Laurent Vivier
Subject: [PULL 01/11] vga: avoid crash if no default vga card
Date: Wed, 29 Jun 2022 11:08:39 +0200

From: Guo Zhi <qtxuning1999@sjtu.edu.cn>

QEMU in some arch will crash when executing -vga help command, because
there is no default vga model.  Add check to this case and avoid crash.

Resolves: https://gitlab.com/qemu-project/qemu/-/issues/978

Signed-off-by: Guo Zhi <qtxuning1999@sjtu.edu.cn>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Tested-by: Thomas Huth <thuth@redhat.com>
Message-Id: <20220503091724.970009-1-qtxuning1999@sjtu.edu.cn>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
---
 softmmu/vl.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/softmmu/vl.c b/softmmu/vl.c
index b24772841db3..3f264d4b0930 100644
--- a/softmmu/vl.c
+++ b/softmmu/vl.c
@@ -981,7 +981,8 @@ static void select_vgahw(const MachineClass *machine_class, 
const char *p)
 
             if (vga_interface_available(t) && ti->opt_name) {
                 printf("%-20s %s%s\n", ti->opt_name, ti->name ?: "",
-                       g_str_equal(ti->opt_name, def) ? " (default)" : "");
+                        (def && g_str_equal(ti->opt_name, def)) ?
+                        " (default)" : "");
             }
         }
         exit(0);
-- 
2.36.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]