should not happen normally, but an inattentive user of that function
may forget to check the validity of the parsed device, so err
on the safe side here

Signed-off-by: Dominik Csapak <d.csa...@proxmox.com>
---
 PVE/QemuServer/USB.pm | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/PVE/QemuServer/USB.pm b/PVE/QemuServer/USB.pm
index 3c8da2c..b669c91 100644
--- a/PVE/QemuServer/USB.pm
+++ b/PVE/QemuServer/USB.pm
@@ -120,6 +120,8 @@ sub print_usbdevice_full {
        $usbdevice .= 
",vendorid=0x$device->{vendorid},productid=0x$device->{productid}";
     } elsif (defined($device->{hostbus}) && defined($device->{hostport})) {
        $usbdevice .= 
",hostbus=$device->{hostbus},hostport=$device->{hostport}";
+    } else {
+       die "no usb id or path given\n";
     }
 
     $usbdevice .= ",id=$deviceid";
-- 
2.30.2



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

Reply via email to