Skip to content
This repository has been archived by the owner on Sep 4, 2021. It is now read-only.

Commit

Permalink
Handle FormattedAddressLines being null
Browse files Browse the repository at this point in the history
I get occasional crashes of the form:
```
Fatal Exception: NSInvalidArgumentException
0  CoreFoundation                 0x184ecafe0 __exceptionPreprocess
1  libobjc.A.dylib                0x18392c538 objc_exception_throw
2  CoreFoundation                 0x184db19b4 -[__NSPlaceholderDictionary initWithObjects:forKeys:count:]
3  CoreFoundation                 0x184db1824 +[NSDictionary dictionaryWithObjects:forKeys:count:]
4  DanceDeets                     0x1004162a4 -[RNGeocoder placemarksToDictionary:] (RNGeocoder.m:97)
5  DanceDeets                     0x1004159d4 __47-[RNGeocoder geocodeAddress:resolver:rejecter:]_block_invoke (RNGeocoder.m:74)
...
```

with:
```
Fatal Exception: NSInvalidArgumentException
*** -[__NSPlaceholderDictionary initWithObjects:forKeys:count:]: attempt to insert nil object from objects[11]
```
  • Loading branch information
mikelambert authored Sep 19, 2017
1 parent c5884ad commit c51d918
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion ios/RNGeocoder/RNGeocoder.m
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ - (NSArray *)placemarksToDictionary:(NSArray *)placemarks {
@"postalCode": placemark.postalCode ?: [NSNull null],
@"adminArea": placemark.administrativeArea ?: [NSNull null],
@"subAdminArea": placemark.subAdministrativeArea ?: [NSNull null],
@"formattedAddress": [lines componentsJoinedByString:@", "]
@"formattedAddress": [lines componentsJoinedByString:@", "] ?: [NSNull null]
};

[results addObject:result];
Expand Down

0 comments on commit c51d918

Please sign in to comment.