Accept empty contexts.json file as valid

This commit is contained in:
Luck 2020-02-11 15:35:16 +00:00
parent d937c9ce06
commit 9f7d431d34
No known key found for this signature in database
GPG Key ID: EFA9B3EC5FD90F8B

View File

@ -63,6 +63,9 @@ public class ContextsFile {
try (BufferedReader reader = Files.newBufferedReader(file, StandardCharsets.UTF_8)) {
JsonObject data = GsonProvider.normal().fromJson(reader, JsonObject.class);
if (data == null) {
return;
}
if (data.has("static-contexts")) {
this.staticContexts = ContextSetJsonSerializer.deserializeContextSet(data.get("static-contexts").getAsJsonObject()).immutableCopy();