Skip to content

Commit

Permalink
Resolved illegal use of nullable values in command line targets
Browse files Browse the repository at this point in the history
Added checks for `nil` before using values, then cast the values to `__nonnull` pointers.

Closes nolanw#49.
  • Loading branch information
dlkinney authored and nolanw committed Nov 25, 2015
1 parent b7d71c9 commit 64683f7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
3 changes: 2 additions & 1 deletion Utilities/Benchmarker.m
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ int main(void) { @autoreleasepool {
}

if ([arguments containsObject:@"selector"]) {
HTMLDocument *selectorsDocument = [HTMLDocument documentWithString:[NSString stringWithContentsOfFile:PathForFixture(@"query-selector.html") usedEncoding:nil error:nil]];
NSString * const HTMLString = [NSString stringWithContentsOfFile:PathForFixture(@"query-selector.html") usedEncoding:nil error:nil];
HTMLDocument *selectorsDocument = (HTMLString) ? [HTMLDocument documentWithString:(NSString * __nonnull)HTMLString] : nil;
NSArray *selectorSuites = [NSArray arrayWithContentsOfFile:PathForFixture(@"query-selector.plist")];
NSUInteger reps = 5;
NSTimeInterval selectorTime = Time(reps, ^{
Expand Down
5 changes: 3 additions & 2 deletions Utilities/EntityFetcher.m
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,9 @@ static inline BOOL is_universal(unsigned int c)

int main(void) { @autoreleasepool
{
static NSString * const EntitiesURL = @"http://www.whatwg.org/specs/web-apps/current-work/multipage/entities.json";
NSData *data = [NSData dataWithContentsOfURL:[NSURL URLWithString:EntitiesURL]];
static NSString * const EntitiesURLString = @"http://www.whatwg.org/specs/web-apps/current-work/multipage/entities.json";
NSURL * const EntitiesURL = [NSURL URLWithString:EntitiesURLString];
NSData *data = (EntitiesURL) ? [NSData dataWithContentsOfURL:(NSURL * __nonnull)EntitiesURL] : nil;
if (!data) {
NSLog(@"could not download entities JSON from %@", EntitiesURL);
return 1;
Expand Down

0 comments on commit 64683f7

Please sign in to comment.