From 06c870867fc469a644c684afd7f2cc0edf135c14 Mon Sep 17 00:00:00 2001 From: Stoiko Ivanov Date: Tue, 5 May 2020 17:22:01 +0200 Subject: [PATCH] only parse version if local sdn file exists if a file does not exist PVE::Tools::file_read_firstline returns undef. This happens e.g. if you install the libpve-network-perl package before creating the local sdn file. Signed-off-by: Stoiko Ivanov --- PVE/Network/SDN/Zones.pm | 3 +++ 1 file changed, 3 insertions(+) diff --git a/PVE/Network/SDN/Zones.pm b/PVE/Network/SDN/Zones.pm index dbb1f30..2ca967f 100644 --- a/PVE/Network/SDN/Zones.pm +++ b/PVE/Network/SDN/Zones.pm @@ -138,6 +138,9 @@ sub write_etc_network_config { sub read_etc_network_config_version { my $versionstr = PVE::Tools::file_read_firstline($local_network_sdn_file); + + return if !defined($versionstr); + if ($versionstr =~ m/^\#version:(\d+)$/) { return $1; } -- 2.39.2