diff options
author | Craig Tiller <craig.tiller@gmail.com> | 2015-09-01 08:04:29 -0700 |
---|---|---|
committer | Craig Tiller <craig.tiller@gmail.com> | 2015-09-01 08:04:29 -0700 |
commit | fb94111259b710bf067dfccf87fe882f1f25ab51 (patch) | |
tree | 4e588a618a52082364ce0877b2161f18ca632676 /src/objective-c/GRPCClient/private/GRPCHost.m | |
parent | 9f80fcf8e79d71e99b28f152a7b8662d815a6ee2 (diff) | |
parent | 7bb3efdaf908ae0f0343adf1b942a4b10ed13fa0 (diff) |
Merge branch 'endpoints' into second-coming
Diffstat (limited to 'src/objective-c/GRPCClient/private/GRPCHost.m')
-rw-r--r-- | src/objective-c/GRPCClient/private/GRPCHost.m | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/objective-c/GRPCClient/private/GRPCHost.m b/src/objective-c/GRPCClient/private/GRPCHost.m index a7142d0f00..a8cd3a0e74 100644 --- a/src/objective-c/GRPCClient/private/GRPCHost.m +++ b/src/objective-c/GRPCClient/private/GRPCHost.m @@ -57,13 +57,16 @@ // Default initializer. - (instancetype)initWithAddress:(NSString *)address { + if (!address) { + return nil; + } // To provide a default port, we try to interpret the address. If it's just a host name without // scheme and without port, we'll use port 443. If it has a scheme, we pass it untouched to the C // gRPC library. // TODO(jcanizales): Add unit tests for the types of addresses we want to let pass untouched. NSURL *hostURL = [NSURL URLWithString:[@"https://" stringByAppendingString:address]]; - if (hostURL && !hostURL.port) { + if (hostURL.host && !hostURL.port) { address = [hostURL.host stringByAppendingString:@":443"]; } |