Check for null map.
This commit is contained in:
@@ -25,11 +25,7 @@ import org.json.simple.JSONArray;
|
|||||||
import org.json.simple.JSONObject;
|
import org.json.simple.JSONObject;
|
||||||
import org.json.simple.JSONValue;
|
import org.json.simple.JSONValue;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -42,6 +38,12 @@ public class Serialization {
|
|||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public static Map<String, Object> toMap(JSONObject object) {
|
public static Map<String, Object> toMap(JSONObject object) {
|
||||||
Map<String, Object> map = new HashMap<>();
|
Map<String, Object> map = new HashMap<>();
|
||||||
|
|
||||||
|
// Weird case of bad meta causing null map to be passed here.
|
||||||
|
if (object == null) {
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
||||||
for (Object key : object.keySet()) {
|
for (Object key : object.keySet()) {
|
||||||
map.put(key.toString(), fromJson(object.get(key)));
|
map.put(key.toString(), fromJson(object.get(key)));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ import java.util.List;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
import java.util.logging.Level;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class to handle vault operations with new UUIDs.
|
* Class to handle vault operations with new UUIDs.
|
||||||
@@ -312,7 +313,9 @@ public class UUIDVaultManager {
|
|||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
yaml.save(file);
|
yaml.save(file);
|
||||||
} catch (IOException ignored) {
|
} catch (Exception e) {
|
||||||
|
PlayerVaults.getInstance().getLogger().log(Level.SEVERE, "Failed to save vault file for: " + holder.toString());
|
||||||
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}.runTaskAsynchronously(PlayerVaults.getInstance());
|
}.runTaskAsynchronously(PlayerVaults.getInstance());
|
||||||
|
|||||||
Reference in New Issue
Block a user