aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/server/0607-Throw-proper-exception-on-empty-JsonList-file.patch
blob: 97b26758f74a59d04549b26205d09675700e7f32 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Mariell Hoversholm <proximyst@proximyst.com>
Date: Sun, 1 Nov 2020 16:43:11 +0100
Subject: [PATCH] Throw proper exception on empty JsonList file


diff --git a/src/main/java/net/minecraft/server/players/StoredUserList.java b/src/main/java/net/minecraft/server/players/StoredUserList.java
index fb5d34913fb7db7d75d974118eb77c3d9833d742..8982562721c3a5a5a3305e90bd8b5bc21585a425 100644
--- a/src/main/java/net/minecraft/server/players/StoredUserList.java
+++ b/src/main/java/net/minecraft/server/players/StoredUserList.java
@@ -187,6 +187,7 @@ public abstract class StoredUserList<K, V extends StoredUserEntry<K>> {
 
             try {
                 JsonArray jsonarray = (JsonArray) StoredUserList.GSON.fromJson(bufferedreader, JsonArray.class);
+                com.google.common.base.Preconditions.checkState(jsonarray != null, "The file \"" + this.file.getName() + "\" is either empty or corrupt"); // Paper
 
                 this.map.clear();
                 Iterator iterator = jsonarray.iterator();