From 17824b557c7ed6c5feaa87e862a8bb6bc6032edc Mon Sep 17 00:00:00 2001
From: Spottedleaf <Spottedleaf@users.noreply.github.com>
Date: Sun, 23 Jun 2024 18:58:31 -0700
Subject: [PATCH] Fix NPE when retrieving an entity with a null UUID

While the null UUID is almost certainly an error, the old
implementation did not NPE as it used a plain HashMap for lookup
by UUID, whereas we use a ConcurrentHashMap which will NPE on
null keys.
---
 patches/server/Chunk-System-Starlight-from-Moonrise.patch | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/patches/server/Chunk-System-Starlight-from-Moonrise.patch b/patches/server/Chunk-System-Starlight-from-Moonrise.patch
index 4cc98a33f0..85e32bab60 100644
--- a/patches/server/Chunk-System-Starlight-from-Moonrise.patch
+++ b/patches/server/Chunk-System-Starlight-from-Moonrise.patch
@@ -5994,7 +5994,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
 +
 +    @Override
 +    public Entity get(final UUID id) {
-+        return maskNonAccessible(this.entityByUUID.get(id));
++        return maskNonAccessible(id == null ? null : this.entityByUUID.get(id));
 +    }
 +
 +    public boolean hasEntity(final UUID uuid) {
@@ -6002,7 +6002,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
 +    }
 +
 +    public String getDebugInfo() {
-+        return "count_id:" + this.entityById.size() + ",count_uuid:" + this.entityByUUID.size() + ",region_count:" + this.regions.size();
++        return "count_id:" + this.entityById.size() + ",count_uuid:" + this.entityByUUID.size() + ",count_accessible:" + this.getEntityCount() + ",region_count:" + this.regions.size();
 +    }
 +
 +    protected static final class ArrayIterable<T> implements Iterable<T> {