From 1ddb7a00144cc90aa30057e5ede1595abaf7e795 Mon Sep 17 00:00:00 2001 From: Dan Mulloy Date: Sat, 14 Apr 2018 13:53:54 -0400 Subject: [PATCH] Fix a null pointer with the Bukkit updater --- .../java/com/comphenix/protocol/updater/BukkitUpdater.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/modules/ProtocolLib/src/main/java/com/comphenix/protocol/updater/BukkitUpdater.java b/modules/ProtocolLib/src/main/java/com/comphenix/protocol/updater/BukkitUpdater.java index e00bb069..2555e91e 100644 --- a/modules/ProtocolLib/src/main/java/com/comphenix/protocol/updater/BukkitUpdater.java +++ b/modules/ProtocolLib/src/main/java/com/comphenix/protocol/updater/BukkitUpdater.java @@ -71,7 +71,7 @@ public class BukkitUpdater extends Updater { /** * Initialize the updater. *

- * Call {@link #start()} to actually start looking (and downloading) updates. + * Call {@link #start(UpdateType)} to actually start looking (and downloading) updates. * * @param plugin The plugin that is checking for an update. * @param id The dev.bukkit.org id of the project @@ -331,10 +331,9 @@ public class BukkitUpdater extends Updater { final BufferedReader reader = new BufferedReader(new InputStreamReader(conn.getInputStream())); final String response = reader.readLine(); + final JSONArray array = response != null ? (JSONArray) JSONValue.parse(response) : null; - final JSONArray array = (JSONArray) JSONValue.parse(response); - - if (array.size() == 0) { + if (array == null || array.size() == 0) { this.plugin.getLogger().warning("The updater could not find any files for the project id " + this.id); this.result = UpdateResult.FAIL_BADID; return false;