mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 03:38:01 +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) {
|
Iterable<Entry<String,Integer>> cardsByName = null;
|
||||||
System.err.println("Warning: ACEditorBase#getAllowedAdditions could not properly process the deck in controller.getModel(), returning empty item pool.");
|
if (deck != null) {
|
||||||
return additions; // returning empty additions
|
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) {
|
for (final Entry<TItem, Integer> itemEntry : itemsToAdd) {
|
||||||
|
|
||||||
final TItem item = itemEntry.getKey();
|
final TItem item = itemEntry.getKey();
|
||||||
@@ -224,7 +222,7 @@ public abstract class ACEditorBase<TItem extends InventoryItem, TModel extends D
|
|||||||
int qty = itemEntry.getValue();
|
int qty = itemEntry.getValue();
|
||||||
|
|
||||||
int max;
|
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())) {
|
limit == CardLimit.None || limitExceptions.contains(card.getName())) {
|
||||||
max = Integer.MAX_VALUE;
|
max = Integer.MAX_VALUE;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user