Fix null or empty has handling in LegacyResourcepackHandler (#1331)

This commit is contained in:
R00tB33rMan
2024-05-28 09:53:20 -04:00
committed by GitHub
parent 42d4288334
commit 1c36b66dcb

View File

@@ -109,7 +109,7 @@ public sealed class LegacyResourcePackHandler extends ResourcePackHandler
break; break;
} }
onResourcePackResponse(new ResourcePackResponseBundle(queued.getId(), onResourcePackResponse(new ResourcePackResponseBundle(queued.getId(),
new String(queued.getHash()), queued.getHash() == null ? "" : new String(queued.getHash()),
PlayerResourcePackStatusEvent.Status.DECLINED)); PlayerResourcePackStatusEvent.Status.DECLINED));
queued = null; queued = null;
} }
@@ -172,6 +172,10 @@ public sealed class LegacyResourcePackHandler extends ResourcePackHandler
@Override @Override
public boolean hasPackAppliedByHash(final byte[] hash) { public boolean hasPackAppliedByHash(final byte[] hash) {
if (hash == null) {
return false;
}
return this.appliedResourcePack != null return this.appliedResourcePack != null
&& Arrays.equals(this.appliedResourcePack.getHash(), hash); && Arrays.equals(this.appliedResourcePack.getHash(), hash);
} }