Fix null display when no version history

Should've been null checked since I made it nullable. String concat
saved us any real damage and so all we saw was "null" shown to users.
Quick check and now we don't.
This commit is contained in:
Zach Brown 2019-05-30 18:31:48 -05:00
parent de002d43b3
commit 550e5f8eaf
No known key found for this signature in database
GPG Key ID: CC9DA35FC5450B76

View File

@ -1,25 +1,26 @@
From 5740e3f1fbd1bcad809d4394f437ffffa3b87bed Mon Sep 17 00:00:00 2001 From 112fed4d2354c631d78ee23707749acf131615df Mon Sep 17 00:00:00 2001
From: Kyle Wood <demonwav@gmail.com> From: Kyle Wood <demonwav@gmail.com>
Date: Thu, 1 Mar 2018 19:37:52 -0600 Date: Thu, 1 Mar 2018 19:37:52 -0600
Subject: [PATCH] Add version history to version command Subject: [PATCH] Add version history to version command
diff --git a/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java b/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java diff --git a/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java b/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java
index ded51d042..e0bd79f60 100644 index ded51d042..513cddb9b 100644
--- a/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java --- a/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java
+++ b/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java +++ b/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java
@@ -25,7 +25,9 @@ public class PaperVersionFetcher implements VersionFetcher { @@ -25,7 +25,10 @@ public class PaperVersionFetcher implements VersionFetcher {
@Override @Override
public String getVersionMessage(@Nonnull String serverVersion) { public String getVersionMessage(@Nonnull String serverVersion) {
String[] parts = serverVersion.substring("git-Paper-".length()).split("[-\\s]"); String[] parts = serverVersion.substring("git-Paper-".length()).split("[-\\s]");
- return getUpdateStatusMessage("PaperMC/Paper", GITHUB_BRANCH_NAME, parts[0]); - return getUpdateStatusMessage("PaperMC/Paper", GITHUB_BRANCH_NAME, parts[0]);
+ String updateMessage = getUpdateStatusMessage("PaperMC/Paper", GITHUB_BRANCH_NAME, parts[0]); + String updateMessage = getUpdateStatusMessage("PaperMC/Paper", GITHUB_BRANCH_NAME, parts[0]);
+ String history = getHistory();
+ +
+ return getHistory() + "\n" + updateMessage; + return history != null ? history + "\n" + updateMessage : updateMessage;
} }
private static @Nullable String getMinecraftVersion() { private static @Nullable String getMinecraftVersion() {
@@ -112,4 +114,19 @@ public class PaperVersionFetcher implements VersionFetcher { @@ -112,4 +115,19 @@ public class PaperVersionFetcher implements VersionFetcher {
return -1; return -1;
} }
} }