aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorWarrior <[email protected]>2023-10-29 00:24:54 +0200
committerGitHub <[email protected]>2023-10-28 15:24:54 -0700
commitb3cac042c1014f3de600db9c77bbf9d946a676df (patch)
tree95a0b2e4a8b38fa28820f99174972686a231785f
parent29350674b31d378e9c16a14443e73b9de6b6738b (diff)
downloadPaper-b3cac042c1014f3de600db9c77bbf9d946a676df.tar.gz
Paper-b3cac042c1014f3de600db9c77bbf9d946a676df.zip
Fix crash when version_history.json is empty (#9871)
-rw-r--r--patches/server/0029-Add-version-history-to-version-command.patch12
1 files changed, 10 insertions, 2 deletions
diff --git a/patches/server/0029-Add-version-history-to-version-command.patch b/patches/server/0029-Add-version-history-to-version-command.patch
index 163d03a670..a83c0451ea 100644
--- a/patches/server/0029-Add-version-history-to-version-command.patch
+++ b/patches/server/0029-Add-version-history-to-version-command.patch
@@ -51,10 +51,10 @@ index 22a55be34fde453fedd987173d95b8b347a03588..9d687da5bdf398bb3f6c84cdf1249a72
}
diff --git a/src/main/java/com/destroystokyo/paper/VersionHistoryManager.java b/src/main/java/com/destroystokyo/paper/VersionHistoryManager.java
new file mode 100644
-index 0000000000000000000000000000000000000000..aac3f66cb23d260729c2a48d8710a9de2346aa22
+index 0000000000000000000000000000000000000000..660b2ec6b63a4ceffee44ab11f54dfa7c0d0996f
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/VersionHistoryManager.java
-@@ -0,0 +1,145 @@
+@@ -0,0 +1,153 @@
+package com.destroystokyo.paper;
+
+import com.google.common.base.MoreObjects;
@@ -116,6 +116,14 @@ index 0000000000000000000000000000000000000000..aac3f66cb23d260729c2a48d8710a9de
+ 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());