From 1482a2bd4666477542f2dd020e506ea2ee2d6b10 Mon Sep 17 00:00:00 2001 From: "ben%bengoodger.com" Date: Sun, 17 Aug 2003 21:06:36 +0000 Subject: [PATCH] Fix for bug 216474 - Browser crashes in password manager. Ensure that we don't crash or overwrite variables used to hold valid password data fields with null. r=bryner --- .../passwordmgr/base/nsPasswordManager.cpp | 23 +++++++++++-------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/toolkit/components/passwordmgr/base/nsPasswordManager.cpp b/toolkit/components/passwordmgr/base/nsPasswordManager.cpp index 44d490504e4..7832c05aeba 100644 --- a/toolkit/components/passwordmgr/base/nsPasswordManager.cpp +++ b/toolkit/components/passwordmgr/base/nsPasswordManager.cpp @@ -621,21 +621,26 @@ nsPasswordManager::OnStateChange(nsIWebProgress* aWebProgress, nsCOMPtr form = do_QueryInterface(formNode); SignonDataEntry* firstMatch = nsnull; - nsCOMPtr userField, passField; + nsCOMPtr userField, passField; + nsCOMPtr temp; for (SignonDataEntry* e = hashEnt->head; e; e = e->next) { nsCOMPtr foundNode; - form->ResolveName(e->userField, getter_AddRefs(foundNode)); - userField = do_QueryInterface(foundNode); - - if (!userField) + form->ResolveName(e->userField, getter_AddRefs(foundNode)); + temp = do_QueryInterface(foundNode); + + if (temp) + userField = temp; + else continue; - form->ResolveName(e->passField, getter_AddRefs(foundNode)); - passField = do_QueryInterface(foundNode); - - if (!passField) + form->ResolveName(e->passField, getter_AddRefs(foundNode)); + temp = do_QueryInterface(foundNode); + + if (temp) + passField = temp; + else continue; if (firstMatch) {