Skip to content

Commit fb25d4b

Browse files
committed
vm: Don't crash if parent of a host device is missing
Host devices that are referenced by the "parent" attribute of other host devices are probably always reported by libvirt, but their retrieval by us might still fail. Let's not crash in this case. See https://issues.redhat.com/browse/RHEL-88405
1 parent d984202 commit fb25d4b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/components/vm/hostdevs/hostDevAdd.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ function devicesHaveAChild(selectableDevices) {
7070
});
7171

7272
Object.values(all).forEach(item => {
73-
if (item.parent && item.parent !== "computer" && (item.capability.type === "usb_device" || item.capability.type === "pci")) {
73+
if (item.parent && all[item.parent] && item.parent !== "computer" && (item.capability.type === "usb_device" || item.capability.type === "pci")) {
7474
all[item.parent].hasChildren = true;
7575
}
7676
});

0 commit comments

Comments
 (0)