Bug 432851 Tools -> Import -> Filters -> Eudora doesn't work. r/sr=bienvenu
authorJeff Beckley <beckley@qualcomm.com>
Tue, 09 Sep 2008 10:06:59 +0100
changeset 294 b19fc26a5e4a72378be7b3d4b93b793560f39bd6
parent 293 4a8d961d55d05f6164cbb1c8f6ea7aaf36c8e392
child 295 3776ea557ca478d5a80e94ecd4fa034650176dec
push idunknown
push userunknown
push dateunknown
bugs432851
Bug 432851 Tools -> Import -> Filters -> Eudora doesn't work. r/sr=bienvenu
mailnews/import/eudora/src/nsEudoraFilters.cpp
--- a/mailnews/import/eudora/src/nsEudoraFilters.cpp
+++ b/mailnews/import/eudora/src/nsEudoraFilters.cpp
@@ -877,31 +877,32 @@ nsresult nsEudoraFilters::AddMailboxActi
 }
 
 nsresult nsEudoraFilters::GetMailboxFolder(const char* pNameHierarchy, nsIMsgFolder** ppFolder)
 {
   NS_ENSURE_ARG_POINTER(ppFolder);
 
   nsCOMPtr<nsIMsgFolder> folder(*ppFolder ? *ppFolder : m_pMailboxesRoot.get());
 
+  // We've already grabbed the pointer on incoming, so now ensure
+  // *ppFolder is null on outgoing if there is an error
+  *ppFolder = nsnull;
+  
   nsCAutoString name(pNameHierarchy + 1);
   PRInt32 sepIndex = name.FindChar(*pNameHierarchy);
   if (sepIndex >= 0)
     name.SetLength(sepIndex);
 
   nsAutoString unicodeName;
   NS_CopyNativeToUnicode(name, unicodeName);
 
   nsCOMPtr<nsIMsgFolder> subFolder;
   nsresult rv = folder->GetChildNamed(unicodeName, getter_AddRefs(subFolder));
   if (NS_SUCCEEDED(rv))
   {
-    folder = subFolder;
+    *ppFolder = subFolder;
     if (sepIndex >= 0)
-      return GetMailboxFolder(pNameHierarchy + sepIndex + 1,
-                              getter_AddRefs(folder));
-    return NS_OK;
+      return GetMailboxFolder(pNameHierarchy + sepIndex + 1, ppFolder);
+    NS_IF_ADDREF(*ppFolder);
   }
 
-  // Must have failed if we got here, so ensure ppFolder is null
-  *ppFolder = nsnull;
   return rv;
 }