From 9db92731a12b661df16dce3930b3ab05d1ef2e56 Mon Sep 17 00:00:00 2001 From: Warrior <50800980+Warriorrrr@users.noreply.github.com> Date: Sun, 29 Oct 2023 00:24:54 +0200 Subject: [PATCH] Fix crash when version_history.json is empty (#9871) --- .../server/Add-version-history-to-version-command.patch | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/patches/server/Add-version-history-to-version-command.patch b/patches/server/Add-version-history-to-version-command.patch index 297be168cb..72e0c5a96f 100644 --- a/patches/server/Add-version-history-to-version-command.patch +++ b/patches/server/Add-version-history-to-version-command.patch @@ -116,6 +116,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + return; + } + ++ if (currentData == null) { ++ // Empty file ++ currentData = new VersionData(); ++ currentData.setCurrentVersion(version); ++ writeFile(path); ++ return; ++ } ++ + if (!version.equals(currentData.getCurrentVersion())) { + // The version appears to have changed + currentData.setOldVersion(currentData.getCurrentVersion());