From 374e5725e99abc34c88319556f1b10e20a0170f8 Mon Sep 17 00:00:00 2001 From: Alex Greenland Date: Wed, 16 Aug 2023 21:26:29 +0100 Subject: [PATCH] Fix for flow upgrade not handling empty files --- scripts/flowupgrade.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/scripts/flowupgrade.py b/scripts/flowupgrade.py index 22fe96dfc..ffb7f5b2f 100755 --- a/scripts/flowupgrade.py +++ b/scripts/flowupgrade.py @@ -111,12 +111,13 @@ def _processFile(self, file): currentFilePath = os.path.join(self._configPath, "modules", file) oldJson = self._loadJsonFile(oldFilePath) - currentJson = self._loadJsonFile(currentFilePath) + if oldJson is not None: + currentJson = self._loadJsonFile(currentFilePath) - currentJson = self._copyModules(oldJson, currentJson) - currentJson = self._updateParams(oldJson, currentJson) + currentJson = self._copyModules(oldJson, currentJson) + currentJson = self._updateParams(oldJson, currentJson) - self._saveJsonFile(currentFilePath, currentJson) + self._saveJsonFile(currentFilePath, currentJson) def _mergeModuleSettings(self, file): oldFilePath = os.path.join(self._priorPath, "modules", file)