alnah005 / Konkan

Flutter game that is popular in my home country (Yemen)
1 stars 0 forks source link

error when tapping set cards button when discarded deck is empty #37

Closed alnah005 closed 4 years ago

FaisalAlwazir commented 4 years ago

Console log

════════ Exception caught by gesture ═══════════════════════════════════════════════════════════════
The following StateError was thrown while handling a gesture:
Bad state: No element

When the exception was thrown, this was the stack: 
#0      List.last (dart:core-patch/growable_array.dart:224:5)
#1      _GameScreenState._handleSetCards (package:solitaire/pages/game_screen.dart:739:72)
#2      _GameScreenState.build.<anonymous closure> (package:solitaire/pages/game_screen.dart:324:17)
#3      _InkResponseState._handleTap (package:flutter/src/material/ink_well.dart:779:19)
#4      _InkResponseState.build.<anonymous closure> (package:flutter/src/material/ink_well.dart:862:36)
...
Handler: "onTap"
Recognizer: TapGestureRecognizer#1ba8f
  debugOwner: GestureDetector
  state: ready
  won arena
  finalPosition: Offset(199.6, 496.0)
  finalLocalPosition: Offset(17.9, 24.2)
  button: 1
  sent tap down
════════════════════════════════════════════════════════════════════════════════════════════════════
FaisalAlwazir commented 4 years ago

Console log

════════ Exception caught by gesture ═══════════════════════════════════════════════════════════════ The following StateError was thrown while handling a gesture: Bad state: No element

When the exception was thrown, this was the stack:

0 List.last (dart:core-patch/growable_array.dart:224:5)

1 _GameScreenState._handleSetCards (package:solitaire/pages/game_screen.dart:739:72)

2 _GameScreenState.build. (package:solitaire/pages/game_screen.dart:324:17)

3 _InkResponseState._handleTap (package:flutter/src/material/ink_well.dart:779:19)

4 _InkResponseState.build. (package:flutter/src/material/ink_well.dart:862:36)

... Handler: "onTap" Recognizer: TapGestureRecognizer#1ba8f debugOwner: GestureDetector state: ready won arena finalPosition: Offset(199.6, 496.0) finalLocalPosition: Offset(17.9, 24.2) button: 1 sent tap down ════════════════════════════════════════════════════════════════════════════════════════════════════

FaisalAlwazir commented 4 years ago

Fixed after https://github.com/alnah005/Konkan/commit/eec29a2768bac12310bdee92f56e92f699373d57