Skip to content

Commit 3b64efd

Browse files
authored
Merge pull request #137 from Winds-Studio/fix1
Fix ArrayIndexOutOfBounds when check book pages
2 parents 93861f4 + d482190 commit 3b64efd

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

api/src/main/java/com/ruinscraft/panilla/api/nbt/checks/NbtCheck_pages.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,14 @@ public NbtCheck_pages() {
2626
private static short[] createCharMap(String string) {
2727
short[] charMap = Arrays.copyOf(EMPTY_CHAR_MAP, EMPTY_CHAR_MAP.length);
2828

29+
if (string == null || string.isEmpty()) {
30+
return charMap;
31+
}
32+
2933
for (char c : string.toCharArray()) {
30-
charMap[c]++;
34+
if (c < MINECRAFT_UNICODE_MAX) {
35+
charMap[c]++;
36+
}
3137
}
3238

3339
return charMap;

0 commit comments

Comments
 (0)