aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorSpottedleaf <[email protected]>2024-06-23 18:58:31 -0700
committerSpottedleaf <[email protected]>2024-06-23 18:59:56 -0700
commitdd49fba8c534d48c3693a751075ecb5836a9d458 (patch)
treebe44b4df64401962f30fde1e9d1957d75edadee6
parentdd31654684877efbf830fbe76f8ea46e813525f5 (diff)
downloadPaper-dd49fba8c534d48c3693a751075ecb5836a9d458.tar.gz
Paper-dd49fba8c534d48c3693a751075ecb5836a9d458.zip
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.
-rw-r--r--patches/server/0991-Chunk-System-Starlight-from-Moonrise.patch6
1 files changed, 3 insertions, 3 deletions
diff --git a/patches/server/0991-Chunk-System-Starlight-from-Moonrise.patch b/patches/server/0991-Chunk-System-Starlight-from-Moonrise.patch
index ab403a02d9..881322c81c 100644
--- a/patches/server/0991-Chunk-System-Starlight-from-Moonrise.patch
+++ b/patches/server/0991-Chunk-System-Starlight-from-Moonrise.patch
@@ -5900,7 +5900,7 @@ index 0000000000000000000000000000000000000000..997b05167c19472acb98edac32d4548c
+}
diff --git a/src/main/java/ca/spottedleaf/moonrise/patches/chunk_system/level/entity/EntityLookup.java b/src/main/java/ca/spottedleaf/moonrise/patches/chunk_system/level/entity/EntityLookup.java
new file mode 100644
-index 0000000000000000000000000000000000000000..3a8c192d1aed186ff506d69e3960e3b2792ddbd1
+index 0000000000000000000000000000000000000000..f6a3eb3d1bb070bcc74133818682571d520d9894
--- /dev/null
+++ b/src/main/java/ca/spottedleaf/moonrise/patches/chunk_system/level/entity/EntityLookup.java
@@ -0,0 +1,1044 @@
@@ -5994,7 +5994,7 @@ index 0000000000000000000000000000000000000000..3a8c192d1aed186ff506d69e3960e3b2
+
+ @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..3a8c192d1aed186ff506d69e3960e3b2
+ }
+
+ 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> {