-
-
Notifications
You must be signed in to change notification settings - Fork 11
Description
This issue is a bug related to duplicate 'MapItemController' keys causing a crash.
Summary:
The app crashes when searching for a location. After the search, two duplicate entries for the same location appear, leading to a fatal error and crash. The error message in the console indicates that there are duplicate keys of type ‘MapItemController’ found in a Dictionary.
Steps to Reproduce:
1. Open the MapItemPicker app.
2. Search for a location.
3. Notice that two identical entries for the same place appear in the search results.
4. The app crashes immediately with the following error message:
Error Message:
Thread 1: Fatal error: Duplicate keys of type 'MapItemController' were found in a Dictionary.
Inside the public extension Array, SchafKit
Expected Behavior:
Only one entry for each location should appear in the search results, and the app should handle duplicate entries gracefully without crashing.
Actual Behavior:
When two duplicate locations are found, the app crashes with the fatal error described above.
Error Stack Trace:
Thread 1: Fatal error: Duplicate keys of type 'MapItemController' were found in a Dictionary.
Environment:
• Device: [iPhone 13 Pro Max]
• iOS Version: [iOS 18.4 Dev Beta 2]
• Xcode Version: [16]
Additional Information:
• The issue seems to occur when the app attempts to display multiple identical results for the same location.
• This issue may be related to how the app handles or stores search results in a dictionary, where duplicate keys are being added.
• The error occurs inside a SwiftUI Array extension.
Suggested Fix:
Consider adding a check before adding new items to the dictionary to ensure there are no duplicates, or switch to a collection type that prevents duplicates, such as a Set. Alternatively, improve the handling of MapItemController keys to ensure they are unique when added to a dictionary.