From 773c4abc8159cbff9ff0347a25baa56657f73cc2 Mon Sep 17 00:00:00 2001
From: Oz Linden <oz@lindenlab.com>
Date: Wed, 12 Dec 2012 10:53:13 -0500
Subject: [PATCH] MAINT-2082: fix deletion of an autoreplace list

---
 .../newview/llfloaterautoreplacesettings.cpp  | 29 ++++++++++++++-----
 1 file changed, 21 insertions(+), 8 deletions(-)

diff --git a/indra/newview/llfloaterautoreplacesettings.cpp b/indra/newview/llfloaterautoreplacesettings.cpp
index 5dcdded7444..6e56e929df6 100644
--- a/indra/newview/llfloaterautoreplacesettings.cpp
+++ b/indra/newview/llfloaterautoreplacesettings.cpp
@@ -514,14 +514,27 @@ bool LLFloaterAutoReplaceSettings::callbackListNameConflict(const LLSD& notifica
 
 void LLFloaterAutoReplaceSettings::onDeleteList()
 {
-	std::string listName= mListNames->getFirstSelected()->getColumn(0)->getValue().asString();
-	mSettings.removeReplacementList(listName); // remove from the copy of settings
-	mReplacementsList->deleteSelectedItems();   // remove from the scrolling list
-
-	mSelectedListName.clear();
-	updateListNames();
-	updateListNamesControls();
-	updateReplacementsList();
+	std::string listName = mListNames->getSelectedValue().asString();
+	if ( ! listName.empty() )
+	{
+		if ( mSettings.removeReplacementList(listName) )
+		{
+			LL_INFOS("AutoReplace")<<"deleted list '"<<listName<<"'"<<LL_ENDL;
+			mReplacementsList->deleteSelectedItems();   // remove from the scrolling list
+			mSelectedListName.clear();
+			updateListNames();
+			updateListNamesControls();
+			updateReplacementsList();
+		}
+		else
+		{
+			LL_WARNS("AutoReplace")<<"failed to delete list '"<<listName<<"'"<<LL_ENDL;
+		}
+	}
+	else
+	{
+		LL_DEBUGS("AutoReplace")<<"no list selected for delete"<<LL_ENDL;
+	}
 }
 
 void LLFloaterAutoReplaceSettings::onExportList()
-- 
GitLab