From 8027eb271ce3d172e603d81c4331fa5de1eeff30 Mon Sep 17 00:00:00 2001 From: "morse%netscape.com" Date: Thu, 7 Sep 2000 07:21:42 +0000 Subject: [PATCH] added some defensive coding to previous checkin --- extensions/cookie/nsCookieService.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/extensions/cookie/nsCookieService.cpp b/extensions/cookie/nsCookieService.cpp index af883ac1806f..e839a14a1db5 100644 --- a/extensions/cookie/nsCookieService.cpp +++ b/extensions/cookie/nsCookieService.cpp @@ -110,10 +110,16 @@ nsCookieService::SetCookieString(nsIURI *aURL, nsIDocument* aDoc, const nsString char *cookie = aCookie.ToNewCString(); nsCOMPtr globalObj; - aDoc->GetScriptGlobalObject(getter_AddRefs(globalObj)); - nsCOMPtr window (do_QueryInterface(globalObj)); nsCOMPtr prompt; - window->GetPrompter(getter_AddRefs(prompt)); + if (aDoc) { + aDoc->GetScriptGlobalObject(getter_AddRefs(globalObj)); + if (globalObj) { + nsCOMPtr window (do_QueryInterface(globalObj)); + if (window) { + window->GetPrompter(getter_AddRefs(prompt)); + } + } + } COOKIE_SetCookieString((char *)spec, prompt, cookie); nsCRT::free(spec);