Put pointer test around smprintf to prevent crash for invalid IMG links.

b=40094,r=adamlock,approved valeski


git-svn-id: svn://10.0.0.236/trunk@71562 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
locka%iol.ie
2000-06-05 22:21:37 +00:00
parent efe702d048
commit 357cc859eb
2 changed files with 12 additions and 8 deletions

View File

@@ -1259,11 +1259,13 @@ nsWebShell::OnEndDocumentLoad(nsIDocumentLoader* loader,
NS_ConvertASCIItoUCS2("dnsNotFound").GetUnicode(),
getter_Copies(messageStr)), NS_ERROR_FAILURE);
PRUnichar *msg = nsTextFormatter::smprintf(messageStr, (const char*)host);
if (!msg) return NS_ERROR_OUT_OF_MEMORY;
if (host) {
PRUnichar *msg = nsTextFormatter::smprintf(messageStr, (const char*)host);
if (!msg) return NS_ERROR_OUT_OF_MEMORY;
prompter->Alert(nsnull, msg);
nsTextFormatter::smprintf_free(msg);
prompter->Alert(nsnull, msg);
nsTextFormatter::smprintf_free(msg);
}
}
else if(aStatus == NS_ERROR_CONNECTION_REFUSED)
{// Doc failed to load because we couldn't connect to the server.