From bc11bd4cafbb6ae2bf7bc7e670a5d1d310f37d2f Mon Sep 17 00:00:00 2001 From: Nassim Jahnke Date: Wed, 17 Nov 2021 19:52:06 +0100 Subject: [PATCH] Set mappings default values to -1 --- .../main/java/com/viaversion/viaversion/api/data/Mappings.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/api/src/main/java/com/viaversion/viaversion/api/data/Mappings.java b/api/src/main/java/com/viaversion/viaversion/api/data/Mappings.java index f8d2e804e..3b83a4bb0 100644 --- a/api/src/main/java/com/viaversion/viaversion/api/data/Mappings.java +++ b/api/src/main/java/com/viaversion/viaversion/api/data/Mappings.java @@ -26,6 +26,8 @@ import com.google.gson.JsonArray; import com.google.gson.JsonElement; import com.google.gson.JsonObject; +import java.util.Arrays; + public interface Mappings { /** @@ -146,6 +148,7 @@ public interface Mappings { final int size = this.size != -1 ? this.size : size(unmapped); final int mappedSize = this.mappedSize != -1 ? this.mappedSize : size(mapped); final int[] mappings = new int[size]; + Arrays.fill(mappings, -1); // Do conversion if one is an array and the other an object, otherwise directly map if (unmapped.isJsonArray()) {