Skip to content

Commit 6f76acd

Browse files
committed
Check if savegame has teleports for the difficulty
Fix crash with mobile savegames
1 parent c8ad1e1 commit 6f76acd

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

  • src/main/java/br/com/pinter/tqrespec/save/player

src/main/java/br/com/pinter/tqrespec/save/player/Player.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1015,6 +1015,9 @@ private TeleportDifficulty getTeleportUidFromDifficulty(int difficulty) {
10151015

10161016
List<VariableInfo> teleportUidsSizeVars = new ArrayList<>(Objects.requireNonNull(block).getVariables().get(Constants.Save.VAR_TELEPORTUIDSSIZE));
10171017
teleportUidsSizeVars.sort(Comparator.comparing(VariableInfo::getKeyOffset));
1018+
if (difficulty < 0 || difficulty >= teleportUidsSizeVars.size()) {
1019+
return null;
1020+
}
10181021
int offsetStart = teleportUidsSizeVars.get(difficulty).getKeyOffset();
10191022
VariableInfo size = teleportUidsSizeVars.get(difficulty);
10201023

0 commit comments

Comments
 (0)