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,16 +447,24 @@ public class FDeckEditor extends TabPageScreen<FDeckEditor> {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected boolean canAddCards() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
public void addCard(PaperCard card) {
|
public void addCard(PaperCard card) {
|
||||||
cardManager.addItem(card, 1);
|
if (canAddCards()) {
|
||||||
parentScreen.getEditorType().getController().notifyModelChanged();
|
cardManager.addItem(card, 1);
|
||||||
updateCaption();
|
parentScreen.getEditorType().getController().notifyModelChanged();
|
||||||
|
updateCaption();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addCards(Iterable<Entry<PaperCard, Integer>> cards) {
|
public void addCards(Iterable<Entry<PaperCard, Integer>> cards) {
|
||||||
cardManager.addItems(cards);
|
if (canAddCards()) {
|
||||||
parentScreen.getEditorType().getController().notifyModelChanged();
|
cardManager.addItems(cards);
|
||||||
updateCaption();
|
parentScreen.getEditorType().getController().notifyModelChanged();
|
||||||
|
updateCaption();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removeCard(PaperCard card) {
|
public void removeCard(PaperCard card) {
|
||||||
@@ -495,8 +503,13 @@ public class FDeckEditor extends TabPageScreen<FDeckEditor> {
|
|||||||
refresh();
|
refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected boolean canAddCards() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
protected String getItemManagerCaption() {
|
protected String getItemManagerCaption() {
|
||||||
return "Catalog";
|
return "Cards";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Reference in New Issue
Block a user