From e88ceecac1ccb6d99eb73dee7a12c7f1d40573de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabian=20Gr=C3=BCnbichler?= Date: Mon, 30 May 2022 10:00:16 +0200 Subject: [PATCH] fix uninitialized value MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit if the configured display hardware has the (optional) default type, but some other attribute is set, this would match against `undef` and spew lots of warnings in the logs. Signed-off-by: Fabian Grünbichler --- PVE/API2/Qemu.pm | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/PVE/API2/Qemu.pm b/PVE/API2/Qemu.pm index a8246574..99b426ec 100644 --- a/PVE/API2/Qemu.pm +++ b/PVE/API2/Qemu.pm @@ -2443,8 +2443,9 @@ __PACKAGE__->register_method({ if ($conf->{vga}) { my $vga = PVE::QemuServer::parse_vga($conf->{vga}); - $status->{spice} = 1 - if $vga->{type} =~ /^virtio/ || PVE::QemuServer::vga_conf_has_spice($conf->{vga}); + my $spice = defined($vga->{type}) && $vga->{type} =~ /^virtio/; + $spice ||= PVE::QemuServer::vga_conf_has_spice($conf->{vga}); + $status->{spice} = 1 if $spice; } $status->{agent} = 1 if PVE::QemuServer::get_qga_key($conf, 'enabled');