diff --git a/mailnews/base/search/resources/content/FilterEditor.js b/mailnews/base/search/resources/content/FilterEditor.js index a005ce5a6cf..7d05c574fe7 100644 --- a/mailnews/base/search/resources/content/FilterEditor.js +++ b/mailnews/base/search/resources/content/FilterEditor.js @@ -161,6 +161,7 @@ function saveFilter() { if (!targetUri || targetUri == "") { var str = Bundle.GetStringFromName("mustSelectFolder"); window.alert(str); + gFilter = null; return false; } gFilter.actionTargetFolderUri = targetUri; @@ -170,13 +171,17 @@ function saveFilter() { if (!gActionPriority.selectedItem) { var str = Bundle.GetStringFromName("mustSelectPriority"); window.alert(str); + gFilter = null; return false; } gFilter.actionPriority = gActionPriority.selectedItem.getAttribute("data"); } + - if (isNewFilter) + if (isNewFilter) { + dump("new filter.. inserting into " + gFilterList + "\n"); gFilterList.insertFilterAt(0, gFilter); + } // success! return true; diff --git a/mailnews/base/search/src/nsMsgFilter.cpp b/mailnews/base/search/src/nsMsgFilter.cpp index dfe728935f1..6a69b0ada19 100644 --- a/mailnews/base/search/src/nsMsgFilter.cpp +++ b/mailnews/base/search/src/nsMsgFilter.cpp @@ -49,6 +49,7 @@ nsMsgRuleAction::~nsMsgRuleAction() nsMsgFilter::nsMsgFilter() : + m_type(1), m_filterList(nsnull) { NS_INIT_REFCNT(); @@ -472,8 +473,8 @@ nsresult nsMsgFilter::SaveRule() GetActionFilingStr(m_action.m_type, actionFilingStr); err = filterList->WriteStrAttr(nsIMsgFilterList::attribAction, actionFilingStr); - if (!NS_SUCCEEDED(err)) - return err; + NS_ENSURE_SUCCESS(err, err); + switch(m_action.m_type) { case nsMsgFilterAction::MoveToFolder: