]> git.proxmox.com Git - qemu-server.git/commitdiff
Avoid to parse empty property string.
authorWolfgang Link <w.link@proxmox.com>
Wed, 28 Sep 2016 07:19:19 +0000 (09:19 +0200)
committerDietmar Maurer <dietmar@proxmox.com>
Tue, 4 Oct 2016 06:35:52 +0000 (08:35 +0200)
Check if string exists before you try to parse it. Remove unnecessary
eval.

PVE/QemuServer.pm

index dbd85a0e1bcbfc6cd7839d9212de77f03e9b87e9..6f889c1d0ec11433569f3314d7c31ae42e366b8d 100644 (file)
@@ -2797,8 +2797,9 @@ sub config_to_command {
 
        die "no uefi base img found\n" if !$ovmfbase;
        push @$cmd, '-drive', "if=pflash,unit=0,format=raw,readonly,file=$ovmfbase";
-       my $d = eval { PVE::JSONSchema::parse_property_string($efidisk_fmt, $conf->{efidisk0}) };
-       if (defined($conf->{efidisk0}) && defined($d) && $ovmfbase eq $OVMF_CODE) {
+
+       if (defined($conf->{efidisk0}) && ($ovmfbase eq $OVMF_CODE)) {
+           my $d = PVE::JSONSchema::parse_property_string($efidisk_fmt, $conf->{efidisk0});
            my $format = $d->{format} // 'raw';
            my $path;
            my ($storeid, $volname) = PVE::Storage::parse_volume_id($d->{file}, 1);