diff --git a/SimDeploy/SMAppDelegate.m b/SimDeploy/SMAppDelegate.m index 4457047..121f011 100644 --- a/SimDeploy/SMAppDelegate.m +++ b/SimDeploy/SMAppDelegate.m @@ -57,8 +57,13 @@ - (void)handleURLEvent:(NSAppleEventDescriptor*)event withReplyEvent:(NSAppleEve NSString *fetchLocation = [queryParams objectForKey:@"url"]; if (nil != fetchLocation) { - if (NO == [fetchLocation hasPrefix:@"http://"]) { - fetchLocation = [NSString stringWithFormat:@"http://%@", fetchLocation]; + NSURL *fetchURL = [NSURL URLWithString:fetchLocation]; + if (nil == fetchURL) { + // fetchLocation is not a valid URL + // maybe it's just missing "http://"? + if (NO == [fetchLocation hasPrefix:@"http://"]) { + fetchLocation = [NSString stringWithFormat:@"http://%@", fetchLocation]; + } } [self.viewController downloadURLAtLocation:fetchLocation];