aboutsummaryrefslogtreecommitdiff
path: root/system
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@redhat.com>2024-07-15 15:44:20 +0400
committerPhilippe Mathieu-Daudé <philmd@linaro.org>2024-07-16 20:04:08 +0200
commita99dc9cd611cbaf10edee6260272e299626d0871 (patch)
treeae6326aebd7c9d118e84a9e610da4ccb7635dd22 /system
parent4bba839808bb1c4f500a11462220a687b4d9ab25 (diff)
vl: fix "type is NULL" in -vga help
Don't pass NULL to module_object_class_by_name(), when the interface is unavailable. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Message-ID: <20240715114420.2062870-1-marcandre.lureau@redhat.com> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Diffstat (limited to 'system')
-rw-r--r--system/vl.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/system/vl.c b/system/vl.c
index bdd2f6ecf6..9e8f16f155 100644
--- a/system/vl.c
+++ b/system/vl.c
@@ -1000,9 +1000,16 @@ static bool vga_interface_available(VGAInterfaceType t)
const VGAInterfaceInfo *ti = &vga_interfaces[t];
assert(t < VGA_TYPE_MAX);
- return !ti->class_names[0] ||
- module_object_class_by_name(ti->class_names[0]) ||
- module_object_class_by_name(ti->class_names[1]);
+
+ if (!ti->class_names[0] || module_object_class_by_name(ti->class_names[0])) {
+ return true;
+ }
+
+ if (ti->class_names[1] && module_object_class_by_name(ti->class_names[1])) {
+ return true;
+ }
+
+ return false;
}
static const char *