[pve-devel] [PATCH qemu-server] Avoid to parse empty property string.

Wolfgang Link w.link at proxmox.com
Wed Sep 28 09:19:19 CEST 2016


Check if string exists before you try to parse it.
---
 PVE/QemuServer.pm | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
index dbd85a0..c7547d4 100644
--- a/PVE/QemuServer.pm
+++ b/PVE/QemuServer.pm
@@ -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 = eval { 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);
-- 
2.1.4




More information about the pve-devel mailing list