5
0
mirror of git://git.proxmox.com/git/qemu-server.git synced 2025-01-10 01:18:01 +03:00

Avoid to parse empty property string.

Check if string exists before you try to parse it. Remove unnecessary
eval.
This commit is contained in:
Wolfgang Link 2016-09-28 09:19:19 +02:00 committed by Dietmar Maurer
parent 2aa7ef3e42
commit 4a5cf64a80

View 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);