Closed giorgio79 closed 1 year ago
It seems provider.cameraPosition
can be null
when the pin has been dragged on the map and _searchByCameraPosition
is called: https://github.com/martin-braun-net/google_maps_place_picker_mb/blob/3.1.1/lib/src/google_map_place_picker.dart#L124-L125
You could fix that easily by checking it at the begin of the function:
if(provider.cameraPosition == null) {
provider.placeSearchingState = SearchingState.Idle;
return;
}
For this rare case, we should just show the idle animation forever, so it doesn't show a wrong location description on the new location. For this rare case, the user just have to re-drag.
This should prevent the crash at least, for now. A much better way would be to figure out why the provider's cameraPosition
is null in the first place and to go up that stack trace and analyze further.
Can you make a tested PR for the null
check on the dev
branch?
It also seems the app crashes when you press the back button while a place is being resolved, might be related.
iOS:
2023-07-28 00:15:03.638924+0200 Runner[72335:22005268] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSArrayM insertObject:atIndex:]: object cannot be nil'
*** First throw call stack:
(
0 CoreFoundation 0x00007ff80045478b __exceptionPreprocess + 242
1 libobjc.A.dylib 0x00007ff80004db73 objc_exception_throw + 48
2 CoreFoundation 0x00007ff8004dc806 _CFThrowFormattedException + 200
3 CoreFoundation 0x00007ff8004d992b -[__NSArrayM insertObject:atIndex:].cold.2 + 0
4 CoreFoundation 0x00007ff80033d8e4 -[__NSArrayM insertObject:atIndex:] + 951
5 Flutter 0x0000000108f0a58b _ZN7flutter30FlutterPlatformViewsController19BringLayersIntoViewENSt21_LIBCPP_ABI_NAMESPACE3mapIxNS1_6vectorINS1_10shared_ptrINS_24FlutterPlatformViewLayerEEENS1_9allocatorIS6_EEEENS1_4lessIxEENS7_INS1_4pairIKxS9_EEEEEE + 309
6 Flutter 0x0000000108f09da0 _ZN7flutter30FlutterPlatformViewsController11SubmitFrameEP15GrDirectContextRKNSt21_LIBCPP_ABI_NAMESPACE10shared_ptrINS_10IOSContextEEENS3_10unique_ptrINS_12SurfaceFrameENS3_14default_deleteISA_EEEE + 1058
7 Flutter 0x0000000108f2a8b3 _ZN7flutter23IOSExternalViewEmbedder11SubmitFrameEP15GrDirectContextNSt21_LIBCPP_ABI_NAMESPACE10unique_ptrINS_12SurfaceFrameENS3_14default_deleteIS5_EEEE + 143
8 Flutter 0x00000001096a7c0f _ZN7flutter10Rasterizer19DrawToSurfaceUnsafeERNS_20FrameTimingsRecorderERNS_9LayerTreeE + 1281
9 Flutter 0x00000001096a9c64 _ZNSt21_LIBCPP_ABI_NAMESPACE10__function6__funcIZN7flutter10Rasterizer13DrawToSurfaceERNS2_20FrameTimingsRecorderERNS2_9LayerTreeEE3$_1NS_9allocatorIS8_EEFvvEEclEv + 26
10 Flutter 0x000000010937591e _ZNK3fml10SyncSwitch7ExecuteERKNS0_8HandlersE + 56
11 Flutter 0x00000001096a61bf _ZN7flutter10Rasterizer13DrawToSurfaceERNS_20FrameTimingsRecorderERNS_9LayerTreeE + 357
12 Flutter 0x00000001096a6f71 _ZN7flutter10Rasterizer6DoDrawENSt21_LIBCPP_ABI_NAMESPACE10unique_ptrINS_20FrameTimingsRecorderENS1_14default_deleteIS3_EEEENS1_10shared_ptrINS_9LayerTreeEEE + 121
13 Flutter 0x00000001096a8775 _ZNSt21_LIBCPP_ABI_NAMESPACE10__function6__funcIZN7flutter10Rasterizer4DrawERKNS_10shared_ptrINS2_8PipelineINS2_13LayerTreeItemEEEEENS_8functionIFbRNS2_9LayerTreeEEEEE3$_1NS_9allocatorISG_EEFvNS_10unique_ptrIS6_NS_14default_deleteIS6_EEEEEEclEOSM_ + 193
14 Flutter 0x00000001096a6a1d _ZN7flutter8PipelineINS_13LayerTreeItemEE7ConsumeERKNSt21_LIBCPP_ABI_NAMESPACE8functionIFvNS3_10unique_ptrIS1_NS3_14default_deleteIS1_EEEEEEE + 193
15 Flutter 0x00000001096a6378 _ZN7flutter10Rasterizer4DrawERKNSt21_LIBCPP_ABI_NAMESPACE10shared_ptrINS_8PipelineINS_13LayerTreeItemEEEEENS1_8functionIFbRNS_9LayerTreeEEEE + 150
16 Flutter 0x00000001096a8aa4 _ZNSt21_LIBCPP_ABI_NAMESPACE10__function6__funcIN3fml8internal14CopyableLambdaIZN7flutter10Rasterizer4DrawERKNS_10shared_ptrINS5_8PipelineINS5_13LayerTreeItemEEEEENS_8functionIFbRNS5_9LayerTreeEEEEE3$_0EENS_9allocatorISK_EEFvvEEclEv + 128
17 Flutter 0x0000000109372315 _ZN3fml15MessageLoopImpl10FlushTasksENS_9FlushTypeE + 163
18 Flutter 0x0000000109378d78 _ZN3fml17MessageLoopDarwin11OnTimerFireEP16__CFRunLoopTimerPS0_ + 26
19 CoreFoundation 0x00007ff8003b3353 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 20
20 CoreFoundation 0x00007ff8003b2eb0 __CFRunLoopDoTimer + 799
21 CoreFoundation 0x00007ff8003b2637 __CFRunLoopDoTimers + 243
22 CoreFoundation 0x00007ff8003acec8 __CFRunLoopRun + 2183
23 CoreFoundation 0x00007ff8003ac264 CFRunLoopRunSpecific + 560
24 GraphicsServices 0x00007ff809b4024e GSEventRunModal + 139
25 UIKitCore 0x0000000112f617bf -[UIApplication _run] + 994
26 UIKitCore 0x0000000112f665de UIApplicationMain + 123
27 Runner 0x000000010414f5cf main + 63
28 dyld 0x00000001054d6384 start_sim + 10
29 ??? 0x0000000105fe141f 0x0 + 4395504671
)
libc++abi: terminating due to uncaught exception of type NSException
(lldb)
Issue should be fixed in the next release. See #70.
This bug popped up in my Crashlytics. No clue how to repro it. Logging it for now.
Fatal Exception: io.flutter.plugins.firebase.crashlytics.FlutterError: Null check operator used on a null value at GoogleMapPlacePicker._searchByCameraLocation(google_map_place_picker.dart:124) at GoogleMapPlacePicker._buildGoogleMapInner..(google_map_place_picker.dart:243)