Unverified Commit f29e6dde by Edward Thomson Committed by GitHub

Merge pull request #5621 from kim/null-safe-git_net_url_is_default_port

Return false instead of segfaulting when checking for default port
parents a5eb7e02 7e1f0b22
......@@ -336,7 +336,12 @@ bool git_net_url_valid(git_net_url *url)
int git_net_url_is_default_port(git_net_url *url)
{
return (strcmp(url->port, default_port_for_scheme(url->scheme)) == 0);
const char *default_port;
if ((default_port = default_port_for_scheme(url->scheme)) != NULL)
return (strcmp(url->port, default_port) == 0);
else
return false;
}
void git_net_url_swap(git_net_url *a, git_net_url *b)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment