From 4a566892982b91c0ffcc82d364b3a65858a762f9 Mon Sep 17 00:00:00 2001 From: R00tB33rMan <36140389+R00tB33rMan@users.noreply.github.com> Date: Sun, 26 May 2024 17:39:36 -0400 Subject: [PATCH] Fix `null` or empty has handling in `LegacyResourcepackHandler` --- .../player/resourcepack/LegacyResourcePackHandler.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/proxy/src/main/java/com/velocitypowered/proxy/connection/player/resourcepack/LegacyResourcePackHandler.java b/proxy/src/main/java/com/velocitypowered/proxy/connection/player/resourcepack/LegacyResourcePackHandler.java index b2b8039911..b1b3254845 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/connection/player/resourcepack/LegacyResourcePackHandler.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/connection/player/resourcepack/LegacyResourcePackHandler.java @@ -109,7 +109,7 @@ private void tickResourcePackQueue() { break; } onResourcePackResponse(new ResourcePackResponseBundle(queued.getId(), - new String(queued.getHash()), + queued.getHash() == null ? "" : new String(queued.getHash()), PlayerResourcePackStatusEvent.Status.DECLINED)); queued = null; } @@ -172,6 +172,10 @@ public boolean onResourcePackResponse( @Override public boolean hasPackAppliedByHash(final byte[] hash) { + if (hash == null) { + return false; + } + return this.appliedResourcePack != null && Arrays.equals(this.appliedResourcePack.getHash(), hash); }