v3.0.1: added safety checks to loading for sandals and spellbook
This commit is contained in:
@@ -65,7 +65,6 @@ import com.watabou.utils.Random;
|
||||
import com.watabou.utils.Reflection;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
|
||||
public class SandalsOfNature extends Artifact {
|
||||
@@ -256,8 +255,11 @@ public class SandalsOfNature extends Artifact {
|
||||
@Override
|
||||
public void restoreFromBundle( Bundle bundle ) {
|
||||
super.restoreFromBundle(bundle);
|
||||
seeds.clear();
|
||||
if (bundle.contains(SEEDS) && bundle.getClassArray(SEEDS) != null) {
|
||||
Collections.addAll(seeds, bundle.getClassArray(SEEDS));
|
||||
for (Class<?> seed : bundle.getClassArray(SEEDS)) {
|
||||
if (seed != null) seeds.add(seed);
|
||||
}
|
||||
}
|
||||
curSeedEffect = bundle.getClass(CUR_SEED_EFFECT);
|
||||
|
||||
|
||||
@@ -61,7 +61,6 @@ import com.watabou.utils.Random;
|
||||
import com.watabou.utils.Reflection;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
|
||||
public class UnstableSpellbook extends Artifact {
|
||||
|
||||
@@ -330,8 +329,10 @@ public class UnstableSpellbook extends Artifact {
|
||||
public void restoreFromBundle( Bundle bundle ) {
|
||||
super.restoreFromBundle(bundle);
|
||||
scrolls.clear();
|
||||
if (bundle.contains(SCROLLS)) {
|
||||
Collections.addAll(scrolls, bundle.getClassArray(SCROLLS));
|
||||
if (bundle.contains(SCROLLS) && bundle.getClassArray(SCROLLS) != null) {
|
||||
for (Class<?> scroll : bundle.getClassArray(SCROLLS)) {
|
||||
if (scroll != null) scrolls.add(scroll);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user