v0.4.3a: fixed nullpointer exceptions caused by new blob bundle restore behaviour

This commit is contained in:
Evan Debenham 2016-10-24 13:55:59 -04:00
parent 46615e0949
commit b104ad197d
5 changed files with 15 additions and 13 deletions

View File

@ -37,6 +37,7 @@ public class Alchemy extends Blob {
public void restoreFromBundle( Bundle bundle ) {
super.restoreFromBundle( bundle );
if (volume > 0)
for (int i=0; i < cur.length; i++) {
if (cur[i] > 0) {
pos = i;

View File

@ -245,7 +245,7 @@ public class Blob extends Actor {
public static int volumeAt( int cell, Class<? extends Blob> type){
Blob gas = Dungeon.level.blobs.get( type );
if (gas == null) {
if (gas == null || gas.volume == 0) {
return 0;
} else {
return gas.cur[cell];

View File

@ -41,6 +41,7 @@ public class WellWater extends Blob {
public void restoreFromBundle( Bundle bundle ) {
super.restoreFromBundle( bundle );
if (volume > 0)
for (int i=0; i < cur.length; i++) {
if (cur[i] > 0) {
pos = i;

View File

@ -66,7 +66,7 @@ public class PotionOfPurity extends Potion {
for (int j=0; j < blobs.length; j++) {
Blob blob = blobs[j];
if (blob == null) {
if (blob == null || blob.volume == 0) {
continue;
}

View File

@ -89,7 +89,7 @@ public class WndInfoCell extends Window {
add(info);
for (Blob blob:Dungeon.level.blobs.values()) {
if (blob.cur[cell] > 0 && blob.tileDesc() != null) {
if (blob.volume > 0 && blob.cur[cell] > 0 && blob.tileDesc() != null) {
if (desc.length() > 0) {
desc += "\n\n";
}