mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-04 18:12:09 +01:00
Fix crash when version_history.json is empty (#9871)
This commit is contained in:
parent
29350674b3
commit
b3cac042c1
1 changed files with 10 additions and 2 deletions
|
@ -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
|
diff --git a/src/main/java/com/destroystokyo/paper/VersionHistoryManager.java b/src/main/java/com/destroystokyo/paper/VersionHistoryManager.java
|
||||||
new file mode 100644
|
new file mode 100644
|
||||||
index 0000000000000000000000000000000000000000..aac3f66cb23d260729c2a48d8710a9de2346aa22
|
index 0000000000000000000000000000000000000000..660b2ec6b63a4ceffee44ab11f54dfa7c0d0996f
|
||||||
--- /dev/null
|
--- /dev/null
|
||||||
+++ b/src/main/java/com/destroystokyo/paper/VersionHistoryManager.java
|
+++ b/src/main/java/com/destroystokyo/paper/VersionHistoryManager.java
|
||||||
@@ -0,0 +1,145 @@
|
@@ -0,0 +1,153 @@
|
||||||
+package com.destroystokyo.paper;
|
+package com.destroystokyo.paper;
|
||||||
+
|
+
|
||||||
+import com.google.common.base.MoreObjects;
|
+import com.google.common.base.MoreObjects;
|
||||||
|
@ -116,6 +116,14 @@ index 0000000000000000000000000000000000000000..aac3f66cb23d260729c2a48d8710a9de
|
||||||
+ return;
|
+ return;
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
|
+ if (currentData == null) {
|
||||||
|
+ // Empty file
|
||||||
|
+ currentData = new VersionData();
|
||||||
|
+ currentData.setCurrentVersion(version);
|
||||||
|
+ writeFile(path);
|
||||||
|
+ return;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
+ if (!version.equals(currentData.getCurrentVersion())) {
|
+ if (!version.equals(currentData.getCurrentVersion())) {
|
||||||
+ // The version appears to have changed
|
+ // The version appears to have changed
|
||||||
+ currentData.setOldVersion(currentData.getCurrentVersion());
|
+ currentData.setOldVersion(currentData.getCurrentVersion());
|
||||||
|
|
Loading…
Reference in a new issue