diff --git a/security/manager/ssl/src/nsCertOverrideService.cpp b/security/manager/ssl/src/nsCertOverrideService.cpp index 916b4637c08..0efb04c2f87 100644 --- a/security/manager/ssl/src/nsCertOverrideService.cpp +++ b/security/manager/ssl/src/nsCertOverrideService.cpp @@ -903,10 +903,12 @@ void nsCertOverrideService::GetHostWithPort(const nsACString & aHostName, PRInt32 aPort, nsACString& _retval) { nsCAutoString hostPort(aHostName); - if (aPort == -1) + if (aPort == -1) { aPort = 443; - hostPort.AppendLiteral(":"); - hostPort.AppendInt(aPort); - + } + if (!hostPort.IsEmpty()) { + hostPort.AppendLiteral(":"); + hostPort.AppendInt(aPort); + } _retval.Assign(hostPort); -} \ No newline at end of file +}