mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 12:18:00 +00:00
Prevent crash when attempting to being build Draft deck immediately after ending drafting process and saving the draft
This commit is contained in:
@@ -60,6 +60,7 @@ public class CEditorDraftingProcess extends ACEditorBase<PaperCard, DeckGroup> {
|
|||||||
private String ccAddLabel = "Add card";
|
private String ccAddLabel = "Add card";
|
||||||
private DragCell allDecksParent = null;
|
private DragCell allDecksParent = null;
|
||||||
private DragCell deckGenParent = null;
|
private DragCell deckGenParent = null;
|
||||||
|
private boolean saved = false;
|
||||||
|
|
||||||
//========== Constructor
|
//========== Constructor
|
||||||
|
|
||||||
@@ -217,6 +218,8 @@ public class CEditorDraftingProcess extends ACEditorBase<PaperCard, DeckGroup> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
saved = true;
|
||||||
|
|
||||||
// Construct computer's decks and save draft
|
// Construct computer's decks and save draft
|
||||||
final Deck[] computer = this.boosterDraft.getDecks();
|
final Deck[] computer = this.boosterDraft.getDecks();
|
||||||
|
|
||||||
@@ -226,11 +229,12 @@ public class CEditorDraftingProcess extends ACEditorBase<PaperCard, DeckGroup> {
|
|||||||
|
|
||||||
Singletons.getModel().getDecks().getDraft().add(finishedDraft);
|
Singletons.getModel().getDecks().getDraft().add(finishedDraft);
|
||||||
CSubmenuDraft.SINGLETON_INSTANCE.update();
|
CSubmenuDraft.SINGLETON_INSTANCE.update();
|
||||||
|
FScreen.DRAFTING_PROCESS.close();
|
||||||
|
|
||||||
|
//open draft pool in Draft Deck Editor right away
|
||||||
Singletons.getControl().setCurrentScreen(FScreen.DECK_EDITOR_DRAFT);
|
Singletons.getControl().setCurrentScreen(FScreen.DECK_EDITOR_DRAFT);
|
||||||
CDeckEditorUI.SINGLETON_INSTANCE.setEditorController(new CEditorLimited(Singletons.getModel().getDecks().getDraft(), FScreen.DECK_EDITOR_DRAFT));
|
CDeckEditorUI.SINGLETON_INSTANCE.setEditorController(new CEditorLimited(Singletons.getModel().getDecks().getDraft(), FScreen.DECK_EDITOR_DRAFT));
|
||||||
CDeckEditorUI.SINGLETON_INSTANCE.getCurrentEditorController().getDeckController().load(null, s);
|
CDeckEditorUI.SINGLETON_INSTANCE.getCurrentEditorController().getDeckController().load(null, s);
|
||||||
FScreen.DRAFTING_PROCESS.close();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//========== Overridden from ACEditorBase
|
//========== Overridden from ACEditorBase
|
||||||
@@ -308,7 +312,7 @@ public class CEditorDraftingProcess extends ACEditorBase<PaperCard, DeckGroup> {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean canSwitchAway(boolean isClosing) {
|
public boolean canSwitchAway(boolean isClosing) {
|
||||||
if (isClosing) {
|
if (isClosing && !saved) {
|
||||||
String userPrompt =
|
String userPrompt =
|
||||||
"This will end the current draft and you will not be able to resume.\n\n" +
|
"This will end the current draft and you will not be able to resume.\n\n" +
|
||||||
"Leave anyway?";
|
"Leave anyway?";
|
||||||
|
|||||||
Reference in New Issue
Block a user