From 8c41c00888bbfe7b1c6501e995554a39a8bf944b Mon Sep 17 00:00:00 2001
From: Mnikolenko Productengine <mnikolenko@productengine.com>
Date: Tue, 5 Jan 2021 17:43:14 +0200
Subject: SL-14632 FIXED The viewer is crashed after deleting the new favorite
 folder

---
 indra/newview/llviewerinventory.cpp | 5 +++++
 1 file changed, 5 insertions(+)

(limited to 'indra/newview')

diff --git a/indra/newview/llviewerinventory.cpp b/indra/newview/llviewerinventory.cpp
index bbed741a33..ed1d726528 100644
--- a/indra/newview/llviewerinventory.cpp
+++ b/indra/newview/llviewerinventory.cpp
@@ -1422,6 +1422,11 @@ void remove_inventory_category(
 			LLNotificationsUtil::add("CannotRemoveProtectedCategories");
 			return;
 		}
+		const LLUUID fav_id = gInventory.findUserDefinedCategoryUUIDForType(LLFolderType::FT_FAVORITE);
+		if ((cat_id == fav_id) || gInventory.isObjectDescendentOf(fav_id, cat_id))
+		{
+			gSavedPerAccountSettings.setString("FavoritesFolder", "");
+		}
         AISAPI::completion_t cr = boost::bind(&doInventoryCb, cb, _1);
         AISAPI::RemoveCategory(cat_id, cr);
 	}
-- 
cgit v1.2.3