From 31e106ced2b37e1cb1b54f9f5f5d56df82577ede Mon Sep 17 00:00:00 2001 From: Yang Tse Date: Thu, 17 Sep 2009 11:45:27 +0000 Subject: Attempt to silence bogus compiler warning: "Potential null pointer dereference" --- lib/url.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'lib/url.c') diff --git a/lib/url.c b/lib/url.c index 011f6c4d7..729149c3d 100644 --- a/lib/url.c +++ b/lib/url.c @@ -3946,9 +3946,11 @@ static CURLcode parse_remote_port(struct SessionHandle *data, conn->host.name++; /* skip over the starting bracket */ portptr = strchr(conn->host.name, ']'); - *portptr++ = 0; /* zero terminate, killing the bracket */ - if(':' != *portptr) - portptr = NULL; /* no port number available */ + if(portptr) { + *portptr++ = '\0'; /* zero terminate, killing the bracket */ + if(':' != *portptr) + portptr = NULL; /* no port number available */ + } } else portptr = strrchr(conn->host.name, ':'); -- cgit v1.2.3