mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-16 18:58:00 +00:00
- A more graceful solution for cases when a deck ends up being null for any reason in ACEditorBase.
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user