]> git.proxmox.com Git - qemu-server.git/commitdiff
fix uninitialized value
authorFabian Grünbichler <f.gruenbichler@proxmox.com>
Mon, 30 May 2022 08:00:16 +0000 (10:00 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Mon, 30 May 2022 10:12:08 +0000 (12:12 +0200)
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 <f.gruenbichler@proxmox.com>
PVE/API2/Qemu.pm

index a824657445bab2933daab20ddbeb016c149ab982..99b426ec5271c9384b1248640e811d5ce29967df 100644 (file)
@@ -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');