diff --git a/src/main/java/forge/deck/DeckFormat.java b/src/main/java/forge/deck/DeckFormat.java index d720fb2f15e..175b920ffef 100644 --- a/src/main/java/forge/deck/DeckFormat.java +++ b/src/main/java/forge/deck/DeckFormat.java @@ -116,6 +116,10 @@ public enum DeckFormat { @SuppressWarnings("incomplete-switch") public String getDeckConformanceProblem(Deck deck) { + if(deck == null) { + return "is not selected"; + } + // That's really a bad dependence if (!Singletons.getModel().getPreferences().getPrefBoolean(FPref.ENFORCE_DECK_LEGALITY)) { return null; diff --git a/src/main/java/forge/gui/home/sanctioned/CSubmenuConstructed.java b/src/main/java/forge/gui/home/sanctioned/CSubmenuConstructed.java index 2a6574906da..31a7e7f82b9 100644 --- a/src/main/java/forge/gui/home/sanctioned/CSubmenuConstructed.java +++ b/src/main/java/forge/gui/home/sanctioned/CSubmenuConstructed.java @@ -92,14 +92,22 @@ public enum CSubmenuConstructed implements ICDoc { view.getCbRemoveSmall().setSelected(prefs.getPrefBoolean(FPref.DECKGEN_NOSMALL)); } - /** @param gameType - * @param lists0   {@link java.util.List}<{@link javax.swing.JList}> */ + /** + * + * @param gameType + */ private void startGame(final GameType gameType) { Deck humanDeck = VSubmenuConstructed.SINGLETON_INSTANCE.getDcHuman().getDeck(); + String humanDeckErrorMessage = gameType.getDecksFormat().getDeckConformanceProblem(humanDeck); + if (null != humanDeckErrorMessage) { + JOptionPane.showMessageDialog(null, "Your deck " + humanDeckErrorMessage, "Invalid deck", JOptionPane.ERROR_MESSAGE); + return; + } - String errorMessage = gameType.getDecksFormat().getDeckConformanceProblem(humanDeck); - if (null != errorMessage) { - JOptionPane.showMessageDialog(null, "Your deck " + errorMessage, "Invalid deck", JOptionPane.ERROR_MESSAGE); + Deck aiDeck = VSubmenuConstructed.SINGLETON_INSTANCE.getDcAi().getDeck(); + String aiDeckErrorMessage = gameType.getDecksFormat().getDeckConformanceProblem(aiDeck); + if (null != aiDeckErrorMessage) { + JOptionPane.showMessageDialog(null, "AI deck " + aiDeckErrorMessage, "Invalid deck", JOptionPane.ERROR_MESSAGE); return; }