diff --git a/app/src/main/java/org/secuso/privacyfriendlysudoku/controller/helper/GameInfoContainer.java b/app/src/main/java/org/secuso/privacyfriendlysudoku/controller/helper/GameInfoContainer.java index 43ed14e..9365a39 100644 --- a/app/src/main/java/org/secuso/privacyfriendlysudoku/controller/helper/GameInfoContainer.java +++ b/app/src/main/java/org/secuso/privacyfriendlysudoku/controller/helper/GameInfoContainer.java @@ -104,6 +104,11 @@ public class GameInfoContainer { fixedValues = new int[s.length()]; for(int i = 0; i < s.length(); i++) { fixedValues[i] = Symbol.getValue(Symbol.SaveFormat, String.valueOf(s.charAt(i)))+1; + if (gameType != GameType.Unspecified && gameType != null) { + if (fixedValues[i] < 0 || fixedValues[i] > gameType.getSize()) { + throw new IllegalArgumentException("Fixed values must each be smaller than " + gameType.getSize() + "."); + } + } } } diff --git a/app/src/main/java/org/secuso/privacyfriendlysudoku/ui/GameActivity.java b/app/src/main/java/org/secuso/privacyfriendlysudoku/ui/GameActivity.java index bf6e48b..3ea9f1b 100644 --- a/app/src/main/java/org/secuso/privacyfriendlysudoku/ui/GameActivity.java +++ b/app/src/main/java/org/secuso/privacyfriendlysudoku/ui/GameActivity.java @@ -125,8 +125,8 @@ public class GameActivity extends BaseActivity implements NavigationView.OnNavig GameType.Unspecified, new int [boardSize], new int [boardSize], new boolean [boardSize][sectionSize]); try { - container.parseFixedValues(input); container.parseGameType("Default_" + sectionSize + "x" + sectionSize); + container.parseFixedValues(input); difficultyCheck = new QQWing(container.getGameType(), GameDifficulty.Unspecified); difficultyCheck.setRecordHistory(true);