mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 11:48:02 +00:00
Merge pull request #4062 from kevlahnota/newmaster2
prevent NPE when loading save with null boosters object
This commit is contained in:
@@ -384,13 +384,17 @@ public class AdventurePlayer implements Serializable, SaveFileContent {
|
|||||||
}
|
}
|
||||||
if (data.containsKey("boosters")) {
|
if (data.containsKey("boosters")) {
|
||||||
Deck[] decks = (Deck[]) data.readObject("boosters");
|
Deck[] decks = (Deck[]) data.readObject("boosters");
|
||||||
for (Deck d : decks) {
|
if (decks != null) {
|
||||||
if (d != null && !d.isEmpty()) {
|
for (Deck d : decks) {
|
||||||
boostersOwned.add(d);
|
if (d != null && !d.isEmpty()) {
|
||||||
} else {
|
boostersOwned.add(d);
|
||||||
System.err.printf("Null or empty booster %s\n", d);
|
} else {
|
||||||
System.out.println("You have an empty booster pack in your inventory.");
|
System.err.printf("Null or empty booster %s\n", d);
|
||||||
|
System.out.println("You have an empty booster pack in your inventory.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
System.err.println("Deck[] is null! [boosters]");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user