Skip to content

Commit

Permalink
Added check for wrong input (not containing any digits).
Browse files Browse the repository at this point in the history
  • Loading branch information
zmej-serow committed May 27, 2020
1 parent 29206e8 commit 0ead125
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/tabs/game_tab.dart
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,9 @@ class ScoresState extends State<Scores> {
}

int parseInput(input) {
return input.split("*").fold(1, (a, b) => a * (int.tryParse(b) ?? 1));
return input.contains(RegExp(r"\d"))
? input.split("*").fold(1, (a, b) => a * (int.tryParse(b) ?? 1))
: null;
}

Widget scoreDialog(BuildContext context, int score) {
Expand Down

0 comments on commit 0ead125

Please sign in to comment.