]> git.proxmox.com Git - qemu-server.git/commit
fix #4435: devices list: avoid error for undefined value
authorFiona Ebner <f.ebner@proxmox.com>
Tue, 10 Jan 2023 13:41:37 +0000 (14:41 +0100)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Wed, 11 Jan 2023 09:14:44 +0000 (10:14 +0100)
commitb3a3e92962e238b00532c4d18a51719623d38003
treef5f72bdad653eb30dd50bfe613fc923c723d8701
parent62b26624c6d951a2e05e3dccdb29884efba31ea8
fix #4435: devices list: avoid error for undefined value

When $d->{'pci_bridge'}->{devices} is undef, @-dereferencing it will
die with:
> Can't use an undefined value as an ARRAY reference

This can happen (at least) when the VM is in 'prelaunch' state. The
QAPI definition for '@PciBridgeInfo' also declares the 'devices'
member as optional.

Before commit 721624b ("collect device list for nested pci-bridges"),
there was no issue, because $d->{'pci_bridge'}->{devices} was used in
foreach, so auto-vivified if undef.

Fixes: f721624b ("collect device list for nested pci-bridges")
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
PVE/QemuServer.pm