From a51fda82aec96fbb1597e04e9919caaef500c2eb Mon Sep 17 00:00:00 2001 From: Eryk Ruta <70776766+kingstefan26@users.noreply.github.com> Date: Sun, 6 Nov 2022 23:27:27 +0100 Subject: added null check for latest map data (#76) --- .../syeyoung/dungeonsguide/mod/dungeon/MapProcessor.java | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/MapProcessor.java b/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/MapProcessor.java index 9c2462ea..6ae4b5c2 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/MapProcessor.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/MapProcessor.java @@ -119,7 +119,7 @@ public class MapProcessor { if (mapData != null) { if(processMapThroddle > 5 && !processlock){ - processMapData(mapData.colors); + processMapData(mapData); processMapThroddle = 0; } processMapThroddle++; @@ -134,10 +134,11 @@ public class MapProcessor { } - private void processMapData(byte[] mapColorData) { + private void processMapData(MapData mapData) { + byte[] mapColorData = mapData.colors; // i just cant get this to work sad - if (isThereDifference(latestMapData.colors, mapColorData)) { + if (isThereDifference(latestMapData, mapColorData)) { context.createEvent(new DungeonMapUpdateEvent(mapColorData)); es.execute(() -> { @@ -403,7 +404,12 @@ public class MapProcessor { return unit1 == unit2 && unit2 == unit3 && unit1 != 0; } - public boolean isThereDifference(byte[] colorData, byte[] colorData1) { + public boolean isThereDifference(MapData latestMapData, byte[] colorData1) { + byte[] colorData = null; + + if(latestMapData != null){ + colorData = latestMapData.colors; + } return true; // boolean equals = Arrays.equals(colorData1, colorData); -- cgit