From b688ea57baa5e090260b6cd422c578e923d10b4c Mon Sep 17 00:00:00 2001 From: "reed@reedloden.com" Date: Wed, 12 Mar 2008 15:51:14 -0700 Subject: [PATCH] Bug 419891 - "Firefox crashes in [@ nsStandardURL::SetFileExtension]" (initialize 'void *ref' in nsMaybeWeakPtr_base::GetValueAs to NULL) [p=honzab@allpeers.com (Honza Bambas [mayhemer]) r=bsmedberg a=blocking-firefox3+] --- toolkit/components/places/src/nsMaybeWeakPtr.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/toolkit/components/places/src/nsMaybeWeakPtr.cpp b/toolkit/components/places/src/nsMaybeWeakPtr.cpp index 9fc94c3b680..fe7e5db6f99 100644 --- a/toolkit/components/places/src/nsMaybeWeakPtr.cpp +++ b/toolkit/components/places/src/nsMaybeWeakPtr.cpp @@ -53,11 +53,12 @@ nsMaybeWeakPtr_base::GetValueAs(const nsIID &iid) const nsCOMPtr weakRef = do_QueryInterface(mPtr); if (weakRef) { rv = weakRef->QueryReferent(iid, &ref); - if (NS_FAILED(rv)) { - ref = nsnull; + if (NS_SUCCEEDED(rv)) { + return ref; } } - return ref; + + return nsnull; } /* static */ nsresult