fixing NPE on draft deck opened in editor

This commit is contained in:
Maxmtg
2012-02-26 06:42:20 +00:00
parent e47a5c5e88
commit cf291b9d95
2 changed files with 15 additions and 2 deletions

View File

@@ -70,6 +70,18 @@ public class DeckGroup extends DeckBase {
public final void setHumanDeck(final Deck humanDeck) {
this.humanDeck = humanDeck;
}
protected void cloneFieldsTo(final DeckBase clone) {
super.cloneFieldsTo(clone);
DeckGroup myClone = (DeckGroup) clone;
myClone.setHumanDeck((Deck)this.getHumanDeck().copyTo(this.getHumanDeck().getName()));
for(int i = 0; i < this.getAiDecks().size(); i++) {
Deck src = this.getAiDecks().get(i);
myClone.addAiDeck((Deck)src.copyTo(src.getName()));
}
}
/**
* Adds the ai deck.

View File

@@ -409,8 +409,9 @@ public final class DeckEditorLimited extends DeckEditorBase<CardPrinted, DeckGro
*/
@Override
public void updateView() {
this.getTopTableWithCards().setDeck(this.getSelectedDeck(this.controller.getModel()).getSideboard());
this.getBottomTableWithCards().setDeck(this.getSelectedDeck(this.controller.getModel()).getMain());
Deck toEdit = this.getSelectedDeck(this.controller.getModel());
this.getTopTableWithCards().setDeck(toEdit.getSideboard());
this.getBottomTableWithCards().setDeck(toEdit.getMain());
}
}