mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 11:48:02 +00:00
Prevent crash when removing cards from deck
This commit is contained in:
@@ -447,17 +447,25 @@ public class FDeckEditor extends TabPageScreen<FDeckEditor> {
|
||||
});
|
||||
}
|
||||
|
||||
protected boolean canAddCards() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public void addCard(PaperCard card) {
|
||||
if (canAddCards()) {
|
||||
cardManager.addItem(card, 1);
|
||||
parentScreen.getEditorType().getController().notifyModelChanged();
|
||||
updateCaption();
|
||||
}
|
||||
}
|
||||
|
||||
public void addCards(Iterable<Entry<PaperCard, Integer>> cards) {
|
||||
if (canAddCards()) {
|
||||
cardManager.addItems(cards);
|
||||
parentScreen.getEditorType().getController().notifyModelChanged();
|
||||
updateCaption();
|
||||
}
|
||||
}
|
||||
|
||||
public void removeCard(PaperCard card) {
|
||||
cardManager.removeItem(card, 1);
|
||||
@@ -495,8 +503,13 @@ public class FDeckEditor extends TabPageScreen<FDeckEditor> {
|
||||
refresh();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean canAddCards() {
|
||||
return false;
|
||||
}
|
||||
|
||||
protected String getItemManagerCaption() {
|
||||
return "Catalog";
|
||||
return "Cards";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user