fix data undefined issue

This commit is contained in:
Alexander Bentkamp
2023-10-02 22:23:55 +02:00
parent a423681150
commit 8db364748b
+3
View File
@@ -55,6 +55,9 @@ function addGameProgress (state: ProgressState, action: PayloadAction<{game: str
if (!state.games[action.payload.game]) {
state.games[action.payload.game] = {inventory: [], openedIntro: true, data: {}, difficulty: DEFAULT_DIFFICULTY}
}
if (!state.games[action.payload.game].data) {
state.games[action.payload.game].data = {}
}
}
/** Add an empty skeleton with progress for the current level */