]> git.proxmox.com Git - qemu-server.git/commitdiff
usb: fix undef error on string match
authorDominik Csapak <d.csapak@proxmox.com>
Mon, 18 Mar 2024 11:18:30 +0000 (12:18 +0100)
committerFiona Ebner <f.ebner@proxmox.com>
Fri, 22 Mar 2024 13:17:53 +0000 (14:17 +0100)
'$entry->{host}' can be empty, so we have to check for that before
doing a regex check, otherwise we get ugly errors in the log

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
PVE/QemuServer.pm

index 8d0ed22cc5d016a56a9c4c2abe0b67a422948f0a..6e2c805228fa9ce05c507ca296de77c04e2e42e5 100644 (file)
@@ -2597,7 +2597,7 @@ sub check_local_resources {
     foreach my $k (keys %$conf) {
        if ($k =~ m/^usb/) {
            my $entry = parse_property_string('pve-qm-usb', $conf->{$k});
-           next if $entry->{host} =~ m/^spice$/i;
+           next if $entry->{host} && $entry->{host} =~ m/^spice$/i;
            if ($entry->{mapping}) {
                $add_missing_mapping->('usb', $k, $entry->{mapping});
                push @$mapped_res, $k;