From f1eb06bbb1eb075b7fa0d5bcd1fff63791f035a8 Mon Sep 17 00:00:00 2001 From: TomTheFurry <46843632+TomTheFurry@users.noreply.github.com> Date: Mon, 14 Mar 2022 14:36:42 +0800 Subject: [PATCH] Fix nullptr exception on calling `clear(d)` with `d` being `null` (Thx @HyperSoop) --- .../lod/core/util/MovableGridRingList.java | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/src/main/java/com/seibel/lod/core/util/MovableGridRingList.java b/src/main/java/com/seibel/lod/core/util/MovableGridRingList.java index e12750fa0..efd8cbb2c 100644 --- a/src/main/java/com/seibel/lod/core/util/MovableGridRingList.java +++ b/src/main/java/com/seibel/lod/core/util/MovableGridRingList.java @@ -32,24 +32,17 @@ public class MovableGridRingList extends ArrayList implements List { @Override public void clear() { - moveLock.writeLock().lock(); - try { - super.clear(); - super.ensureCapacity(size*size); - for (int i=0; i d) { moveLock.writeLock().lock(); try { - super.forEach((t) -> { - if (t!=null) d.accept(t); - }); + if (d != null) { + super.forEach((t) -> { + if (t!=null) d.accept(t); + }); + } super.clear(); super.ensureCapacity(size*size); for (int i=0; i