- A more graceful solution for cases when a deck ends up being null for any reason in ACEditorBase.

This commit is contained in:
Agetian
2017-01-11 18:55:17 +00:00
parent 01e402f292
commit 78b6c3610d

View File

@@ -209,14 +209,12 @@ public abstract class ACEditorBase<TItem extends InventoryItem, TModel extends D
}
}
if (deck == null) {
System.err.println("Warning: ACEditorBase#getAllowedAdditions could not properly process the deck in controller.getModel(), returning empty item pool.");
return additions; // returning empty additions
Iterable<Entry<String,Integer>> cardsByName = null;
if (deck != null) {
final CardPool allCards = deck.getAllCardsInASinglePool(deck.has(DeckSection.Commander));
cardsByName = Aggregates.groupSumBy(allCards, PaperCard.FN_GET_NAME);
}
final CardPool allCards = deck.getAllCardsInASinglePool(deck.has(DeckSection.Commander));
Iterable<Entry<String,Integer>> cardsByName = Aggregates.groupSumBy(allCards, PaperCard.FN_GET_NAME);
for (final Entry<TItem, Integer> itemEntry : itemsToAdd) {
final TItem item = itemEntry.getKey();
@@ -224,7 +222,7 @@ public abstract class ACEditorBase<TItem extends InventoryItem, TModel extends D
int qty = itemEntry.getValue();
int max;
if (card == null || card.getRules().getType().isBasic() ||
if (deck == null || card == null || card.getRules().getType().isBasic() ||
limit == CardLimit.None || limitExceptions.contains(card.getName())) {
max = Integer.MAX_VALUE;
}