Skip to content

Commit 131a8cb

Browse files
committed
(fix) StringIndexOutOfBoundsException on empty json string trimming
1 parent 716bd94 commit 131a8cb

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/main/java/me/crafter/mc/lockettepro/Utils.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -315,9 +315,11 @@ public static String getSignLineFromUnknown(WrappedChatComponent rawline) {
315315
}
316316

317317
public static String getSignLineFromUnknown(String json) {
318-
if(!json.contains("{")){
318+
if (json.isEmpty()) {
319+
return "";
320+
} else if (!json.contains("{")) {
319321
return trimNbtRawString(json);
320-
}else{
322+
} else {
321323
JsonObject line = getJsonObjectOrNull(json);
322324
if (line == null) return json;
323325

@@ -351,7 +353,7 @@ public static List<Integer> getMinecraftInList(String versionString) {
351353
return list;
352354
}
353355

354-
public static boolean isMinecraftVersionHigherThan(String version,String compareTo) {
356+
public static boolean isMinecraftVersionHigherThan(String version, String compareTo) {
355357
List<Integer> versionInList = getMinecraftInList(version);
356358
List<Integer> compareToInList = getMinecraftInList(compareTo);
357359
for (int i = 0; i < Math.min(versionInList.size(), compareToInList.size()); i++) {

0 commit comments

Comments
 (0)