fix: If user.levels is empty then no level can be started

This commit is contained in:
Alexander Polynomdivision 2018-10-07 13:50:22 +02:00
parent e398417c99
commit 5c1332da36

View File

@ -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);