summaryrefslogtreecommitdiffstats
path: root/softmmu
diff options
context:
space:
mode:
authorGuo Zhi2022-05-03 11:17:24 +0200
committerLaurent Vivier2022-06-28 10:43:05 +0200
commit6985d8ede92494f3b791de01e8ee9306eb6d5e4a (patch)
treee4a75f82828608be40fa42d693105c3899e8ab9d /softmmu
parentMerge tag 'pull-semi-20220628' of https://gitlab.com/rth7680/qemu into staging (diff)
downloadqemu-6985d8ede92494f3b791de01e8ee9306eb6d5e4a.tar.gz
qemu-6985d8ede92494f3b791de01e8ee9306eb6d5e4a.tar.xz
qemu-6985d8ede92494f3b791de01e8ee9306eb6d5e4a.zip
vga: avoid crash if no default vga card
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>
Diffstat (limited to 'softmmu')
-rw-r--r--softmmu/vl.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/softmmu/vl.c b/softmmu/vl.c
index b24772841d..3f264d4b09 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);