forked from TAIGA/TAIGA
fixed possible NPE
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
package com.sosnitzka.taiga.world;
|
package com.sosnitzka.taiga.world;
|
||||||
|
|
||||||
|
import com.google.common.reflect.TypeToken;
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
@@ -53,8 +54,8 @@ public class MeteorWorldSaveData extends WorldSavedData {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void readFromNBT(NBTTagCompound nbt) {
|
public void readFromNBT(NBTTagCompound nbt) {
|
||||||
if (nbt.hasKey("posData")) {
|
if (nbt.hasKey("posData") && !nbt.getString("posData").isEmpty()) {
|
||||||
posList = new Gson().fromJson(nbt.getString("posData"), posList.getClass());
|
posList = new Gson().fromJson(nbt.getString("posData"), new TypeToken<List<BlockPos>>(){}.getType());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user