osmandapp / OsmAnd-iOS

OsmAnd for iOS
Other
288 stars 92 forks source link

Crash in Add favorite dialog after selecting new folder #4136

Closed dmpr0 closed 2 days ago

dmpr0 commented 4 days ago

Description

How to reproduce

Actual result

Crash ``` *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Attempted to perform update with invalid index path: {length = 2, path = 2 - 18446744073709551615}' *** First throw call stack: ( 0 CoreFoundation 0x0000000113edb369 __exceptionPreprocess + 242 1 libobjc.A.dylib 0x000000010d026106 objc_exception_throw + 62 2 Foundation 0x000000010ee808b4 -[NSMutableDictionary(NSMutableDictionary) classForCoder] + 0 3 UIKitCore 0x000000015489945b _UIAssertValidUpdateIndexPath + 223 4 UIKitCore 0x00000001548992f2 -[UIUpdateItem initWithAction:forIndexPath:animation:] + 54 5 UIKitCore 0x00000001548377da -[UITableView _updateRowsAtIndexPaths:withUpdateAction:rowAnimation:usingPresentationValues:] + 525 6 UIKitCore 0x0000000154837d87 -[UITableView reloadRowsAtIndexPaths:withRowAnimation:] + 178 7 OsmAnd Maps.debug.dylib 0x00000001152f1f58 -[OAEditPointViewController onGroupChanged:] + 2664 8 OsmAnd Maps.debug.dylib 0x00000001152ea8b2 -[OAEditPointViewController onItemSelected:] + 98 9 OsmAnd Maps.debug.dylib 0x0000000115035ebc -[OAFolderCardsCell collectionView:didSelectItemAtIndexPath:] + 332 10 UIKitCore 0x00000001538d62df -[UICollectionView _selectItemAtIndexPath:animated:scrollPosition:notifyDelegate:deselectPrevious:performPrimaryAction:performCustomSelectionAction:] + 1239 11 UIKitCore 0x0000000153918c2d -[UICollectionView _userSelectItemAtIndexPath:animatedSelection:] + 307 12 UIKitCore 0x0000000153918f82 -[UICollectionView touchesEnded:withEvent:] + 622 13 UIKitCore 0x00000001545726a4 forwardTouchMethod + 416 14 UIKitCore 0x00000001545726a4 forwardTouchMethod + 416 15 UIKitCore 0x00000001535c9701 -[UIGestureDelayedEventComponentDispatcher sendDelayedTouches] + 3927 16 UIKitCore 0x0000000153e8b70d _UIGestureEnvironmentUpdate + 5806 17 UIKitCore 0x0000000153e89c0e -[UIGestureEnvironment _updateForEvent:window:] + 847 18 UIKitCore 0x0000000154587ccd -[UIWindow sendEvent:] + 4937 19 UIKitCore 0x000000015455ce8f -[UIApplication sendEvent:] + 525 20 UIKitCore 0x00000001546144b4 __dispatchPreprocessedEventFromEventQueue + 1436 21 UIKitCore 0x00000001546187a8 __processEventQueue + 8610 22 UIKitCore 0x000000015460dc25 updateCycleEntry + 151 23 UIKitCore 0x00000001536e638c _UIUpdateSequenceRun + 55 24 UIKitCore 0x000000015442167f schedulerStepScheduledMainSection + 165 25 UIKitCore 0x00000001544207a4 runloopSourceCallback + 68 26 CoreFoundation 0x0000000113e3a91e __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17 27 CoreFoundation 0x0000000113e3a860 __CFRunLoopDoSource0 + 157 28 CoreFoundation 0x0000000113e3a065 __CFRunLoopDoSources0 + 203 29 CoreFoundation 0x0000000113e34774 __CFRunLoopRun + 960 30 CoreFoundation 0x0000000113e33fb3 CFRunLoopRunSpecific + 536 31 GraphicsServices 0x000000013126e0cb GSEventRunModal + 137 32 UIKitCore 0x000000015453bc3b -[UIApplication _run] + 875 33 UIKitCore 0x0000000154540b7c UIApplicationMain + 123 34 OsmAnd Maps.debug.dylib 0x0000000115850490 __debug_main_executable_dylib_entry_point + 96 35 dyld 0x000000010aebe478 start_sim + 10 36 ??? 0x0000000202afa2cd 0x0 + 8634999501 ) libc++abi: terminating due to uncaught exception of type NSException ```
Screenshot

Expected result

Environment OsmAnd Version: 4.9.0.4 Android/iOS version: 18.3 Device model: iPhone 16 Pro Max

Anna2405 commented 4 days ago

Reproduced on: Device Iphone 13, OS iOS 17.5.1 Version/Build 4.9.0.4 Actual result: the selected location on the map is not saved to the "Personal" folder, the application crashes Expected result: The selected location on the map is saved in the "Personal" folder Precondition:Use the context menu, select the "Add new folder" option. Enter a name for your new folder, for example, “Personal", and save the changes. 1 Open the application; 2 The user taps the selected place to add to "Personal"; 3 A tab opens with the ability to add "To favorites"; 4 The user taps on "Favorites"; 5 A new window opens where the "Personal" category is selected; 6 The selected place is saved in "Personal", which are available for quick use in "Navigation" or "My places"

https://github.com/user-attachments/assets/c0dfa6ab-8958-448d-ab20-e44e5e8dbf2e

tigrim commented 2 days ago

The issue was fixed in https://github.com/osmandapp/OsmAnd-iOS/commit/3f2d3bfa0202f3ef8c998e13b25c8fbf57aa88ea