From 5c1332da365e81ac75e00df64c1b513a06d7cb9e Mon Sep 17 00:00:00 2001 From: Alexander Polynomdivision Date: Sun, 7 Oct 2018 13:50:22 +0200 Subject: [PATCH] fix: If user.levels is empty then no level can be started --- frontend/src/pages/levelList.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/src/pages/levelList.tsx b/frontend/src/pages/levelList.tsx index d194e75..74fb7c1 100644 --- a/frontend/src/pages/levelList.tsx +++ b/frontend/src/pages/levelList.tsx @@ -44,7 +44,7 @@ const LevelListWithRouter = withRouter( toLevel(id: number) { const maxLevel = Math.max(...this.props.user.levels); - if (maxLevel + 1 >= id) { + if ((maxLevel === -Infinity || maxLevel === +Infinity) || maxLevel + 1 >= id) { this.props.history.push(`/level/${id}`); } else { this.props.setSnackbar(true);