closes #291: merge in parts of @RubioV/RMBingSource-offline-crash-fix
Showing
3 changed files
with
10 additions
and
3 deletions
@@ -85,7 +85,11 @@ | @@ -85,7 +85,11 @@ | ||
85 | 85 | ||
86 | NSArray *URLs = [self URLsForTile:tile]; | 86 | NSArray *URLs = [self URLsForTile:tile]; |
87 | 87 | ||
88 | - if ([URLs count] > 1) | 88 | + if ([URLs count] == 0) |
89 | + { | ||
90 | + return nil; | ||
91 | + } | ||
92 | + else if ([URLs count] > 1) | ||
89 | { | 93 | { |
90 | // fill up collection array with placeholders | 94 | // fill up collection array with placeholders |
91 | // | 95 | // |
@@ -27,7 +27,7 @@ | @@ -27,7 +27,7 @@ | ||
27 | 27 | ||
28 | #import "RMAbstractWebMapSource.h" | 28 | #import "RMAbstractWebMapSource.h" |
29 | 29 | ||
30 | -typedef enum NSUInteger { | 30 | +typedef enum : NSUInteger { |
31 | RMBingImagerySetRoad = 0, // default | 31 | RMBingImagerySetRoad = 0, // default |
32 | RMBingImagerySetAerial = 1, | 32 | RMBingImagerySetAerial = 1, |
33 | RMBingImagerySetAerialWithLabels = 2, | 33 | RMBingImagerySetAerialWithLabels = 2, |
@@ -75,7 +75,10 @@ | @@ -75,7 +75,10 @@ | ||
75 | 75 | ||
76 | NSData *metadataData = [NSData brandedDataWithContentsOfURL:metadataURL]; | 76 | NSData *metadataData = [NSData brandedDataWithContentsOfURL:metadataURL]; |
77 | 77 | ||
78 | - id metadata = [NSJSONSerialization JSONObjectWithData:metadataData options:0 error:nil]; | 78 | + if ( ! metadataData) |
79 | + return nil; | ||
80 | + | ||
81 | + id metadata = [NSJSONSerialization JSONObjectWithData:metadataData options:0 error:NULL]; | ||
79 | 82 | ||
80 | if (metadata && [metadata isKindOfClass:[NSDictionary class]] && [[metadata objectForKey:@"statusCode"] intValue] == 200) | 83 | if (metadata && [metadata isKindOfClass:[NSDictionary class]] && [[metadata objectForKey:@"statusCode"] intValue] == 200) |
81 | { | 84 | { |
-
Please register or login to post a comment