Fix loading gas tank's with null gas stored. Fixes #5470

This commit is contained in:
pupnewfster committed 2019-05-12 12:39:39 -04:00
1 parent 0d4b50908f
commit 40620ec23b
2 files changed
+3 -2

No files matched your search

+2 -1
View File
@@ -1,5 +1,6 @@
package mekanism.api.gas;
import javax.annotation.Nullable;
import net.minecraft.nbt.NBTTagCompound;
/**
@@ -44,6 +45,7 @@ public class GasStack {
*
* @return GasStack stored in the tag compound
*/
@Nullable
public static GasStack readFromNBT(NBTTagCompound nbtTags) {
if (nbtTags == null || nbtTags.isEmpty()) {
return null;
@@ -70,7 +72,6 @@ public class GasStack {
public GasStack withAmount(int newAmount) {
amount = newAmount;
return this;
}
+1 -1
View File
@@ -217,7 +217,7 @@ public class GasTank implements GasTankInfo {
public void read(NBTTagCompound nbtTags) {
if (nbtTags.hasKey("stored")) {
stored = GasStack.readFromNBT(nbtTags.getCompoundTag("stored"));
if (stored.amount <= 0) {
if (stored != null && stored.amount <= 0) {
//fix any old data that may be broken
stored = null;
}