From: Fabian Grünbichler Date: Wed, 9 Mar 2016 11:39:54 +0000 (+0100) Subject: fix #910: Correctly handle undef X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=947c04dcf294321b18511772b68154f12b32f94e;p=pve-zsync.git fix #910: Correctly handle undef --- diff --git a/pve-zsync b/pve-zsync index d517ece..5fecbc2 100644 --- a/pve-zsync +++ b/pve-zsync @@ -425,7 +425,7 @@ sub list { $list .= sprintf("%-25s", cut_target_width($name, 25)); $list .= sprintf("%-10s", $states->{$source}->{$name}->{state}); $list .= sprintf("%-20s", $states->{$source}->{$name}->{lsync}); - $list .= sprintf("%-6s", $states->{$source}->{$name}->{vm_type}); + $list .= sprintf("%-6s", defined($states->{$source}->{$name}->{vm_type}) ? $states->{$source}->{$name}->{vm_type} : "undef"); $list .= sprintf("%-5s\n", $cfg->{$source}->{$name}->{method}); } } @@ -440,6 +440,8 @@ sub vm_exists { my $res = undef; + return undef if !defined($target->{vmid}); + eval { $res = run_cmd([@cmd, 'ls', "$QEMU_CONF/$target->{vmid}.conf"]) }; return "qemu" if $res;