修复部分神秘情况下GunData.from NPE的问题
This commit is contained in:
parent
825cd772e6
commit
0ba0e22e82
1 changed files with 5 additions and 3 deletions
|
@ -60,10 +60,12 @@ public class GunData {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static GunData from(ItemStack stack) {
|
public static GunData from(ItemStack stack) {
|
||||||
if (!dataCache.containsKey(stack)) {
|
var value = dataCache.get(stack);
|
||||||
dataCache.put(stack, new GunData(stack));
|
if (value == null) {
|
||||||
|
value = new GunData(stack);
|
||||||
|
dataCache.put(stack, value);
|
||||||
}
|
}
|
||||||
return dataCache.get(stack);
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public GunItem item() {
|
public GunItem item() {
|
||||||
|
|
Loading…
Add table
Reference in a new issue