mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 03:08:02 +00:00
Support deleting decks without crashing
This commit is contained in:
@@ -314,6 +314,7 @@ public class FDeckEditor extends TabPageScreen<FDeckEditor> {
|
|||||||
public void setDeck(Deck deck0) {
|
public void setDeck(Deck deck0) {
|
||||||
if (deck == deck0) { return; }
|
if (deck == deck0) { return; }
|
||||||
deck = deck0;
|
deck = deck0;
|
||||||
|
if (deck == null) { return; }
|
||||||
|
|
||||||
//reinitialize tab pages when deck changes
|
//reinitialize tab pages when deck changes
|
||||||
for (TabPage<FDeckEditor> tabPage : tabPages) {
|
for (TabPage<FDeckEditor> tabPage : tabPages) {
|
||||||
@@ -641,6 +642,8 @@ public class FDeckEditor extends TabPageScreen<FDeckEditor> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Deck getDeck() {
|
public Deck getDeck() {
|
||||||
|
if (model == null) { return null; }
|
||||||
|
|
||||||
if (model instanceof Deck) {
|
if (model instanceof Deck) {
|
||||||
return (Deck) model;
|
return (Deck) model;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user