-
Notifications
You must be signed in to change notification settings - Fork 51
Open
Description
Hello,
It looks like when popping back to the root of our app the Instabug navigation observer causes an uncaught exception when removing an item from a list that is empty. There is an if check around it but it is an async/await. So it looks like in the meantime while the async call is running the list can change, causing this exception.
So I suspect it goes like this
if _steps.isNotEmpty
-> reportScreenChange
gets called and asynchronously _steps
gets changed -> _steps.removeLast(); on a now empty list without checking if it is empty after the await
I created a potential fix for it: #639
E/flutter ( 6807): [ERROR:flutter/runtime/dart_vm_initializer.cc(40)] Unhandled Exception: RangeError (length): Invalid value: Valid value range is empty: -1
E/flutter ( 6807): #0 List.[] (dart:core-patch/growable_array.dart)
E/flutter ( 6807): #1 List.removeLast (dart:core-patch/growable_array.dart:345:20)
E/flutter ( 6807): #2 InstabugNavigatorObserver.screenChanged.<anonymous closure> (package:instabug_flutter/src/utils/instabug_navigator_observer.dart:33:18)
E/flutter ( 6807): <asynchronous suspension>
Metadata
Metadata
Assignees
Labels
No labels