From 1728556ba7283873f20427459dbf2bc74e405ccb Mon Sep 17 00:00:00 2001
From: Mnikolenko ProductEngine <mnikolenko@productengine.com>
Date: Mon, 28 Jul 2014 11:01:00 +0300
Subject: MAINT-4286 FIXED Dragging outfits folder onto cloud avatar in Bear
 crashes the viewer

---
 indra/newview/llaisapi.cpp | 21 +++++++++++++++------
 1 file changed, 15 insertions(+), 6 deletions(-)

(limited to 'indra/newview/llaisapi.cpp')

diff --git a/indra/newview/llaisapi.cpp b/indra/newview/llaisapi.cpp
index da66ea357a..623458cb08 100755
--- a/indra/newview/llaisapi.cpp
+++ b/indra/newview/llaisapi.cpp
@@ -380,8 +380,11 @@ void AISUpdate::parseMeta(const LLSD& update)
 		 it != cat_ids.end(); ++it)
 	{
 		LLViewerInventoryCategory *cat = gInventory.getCategory(*it);
-		mCatDescendentDeltas[cat->getParentUUID()]--;
-		mObjectsDeletedIds.insert(*it);
+		if(cat)
+		{
+			mCatDescendentDeltas[cat->getParentUUID()]--;
+			mObjectsDeletedIds.insert(*it);
+		}
 	}
 
 	// parse _categories_items_removed -> mObjectsDeletedIds
@@ -392,8 +395,11 @@ void AISUpdate::parseMeta(const LLSD& update)
 		 it != item_ids.end(); ++it)
 	{
 		LLViewerInventoryItem *item = gInventory.getItem(*it);
-		mCatDescendentDeltas[item->getParentUUID()]--;
-		mObjectsDeletedIds.insert(*it);
+		if(item)
+		{
+			mCatDescendentDeltas[item->getParentUUID()]--;
+			mObjectsDeletedIds.insert(*it);
+		}
 	}
 
 	// parse _broken_links_removed -> mObjectsDeletedIds
@@ -403,8 +409,11 @@ void AISUpdate::parseMeta(const LLSD& update)
 		 it != broken_link_ids.end(); ++it)
 	{
 		LLViewerInventoryItem *item = gInventory.getItem(*it);
-		mCatDescendentDeltas[item->getParentUUID()]--;
-		mObjectsDeletedIds.insert(*it);
+		if(item)
+		{
+			mCatDescendentDeltas[item->getParentUUID()]--;
+			mObjectsDeletedIds.insert(*it);
+		}
 	}
 
 	// parse _created_items
-- 
cgit v1.2.3


From 06b605b8666f2336e77126f8ff47765115c08a27 Mon Sep 17 00:00:00 2001
From: "Brad Payne (Vir Linden)" <vir@lindenlab.com>
Date: Fri, 8 Aug 2014 15:20:28 -0400
Subject: MAINT-4257 WIP - already fixed by MAINT-4286, added some warnings

---
 indra/newview/llaisapi.cpp | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

(limited to 'indra/newview/llaisapi.cpp')

diff --git a/indra/newview/llaisapi.cpp b/indra/newview/llaisapi.cpp
index 623458cb08..96de15bf75 100755
--- a/indra/newview/llaisapi.cpp
+++ b/indra/newview/llaisapi.cpp
@@ -385,6 +385,10 @@ void AISUpdate::parseMeta(const LLSD& update)
 			mCatDescendentDeltas[cat->getParentUUID()]--;
 			mObjectsDeletedIds.insert(*it);
 		}
+		else
+		{
+			LL_WARNS("Inventory") << "removed category not found " << *it << LL_ENDL;
+		}
 	}
 
 	// parse _categories_items_removed -> mObjectsDeletedIds
@@ -400,6 +404,10 @@ void AISUpdate::parseMeta(const LLSD& update)
 			mCatDescendentDeltas[item->getParentUUID()]--;
 			mObjectsDeletedIds.insert(*it);
 		}
+		else
+		{
+			LL_WARNS("Inventory") << "removed item not found " << *it << LL_ENDL;
+		}
 	}
 
 	// parse _broken_links_removed -> mObjectsDeletedIds
@@ -414,6 +422,10 @@ void AISUpdate::parseMeta(const LLSD& update)
 			mCatDescendentDeltas[item->getParentUUID()]--;
 			mObjectsDeletedIds.insert(*it);
 		}
+		else
+		{
+			LL_WARNS("Inventory") << "broken link not found " << *it << LL_ENDL;
+		}
 	}
 
 	// parse _created_items
@@ -804,7 +816,7 @@ void AISUpdate::doUpdate()
 		// Since this is a copy of the category *before* the accounting update, above,
 		// we need to transfer back the updated version/descendent count.
 		LLViewerInventoryCategory* curr_cat = gInventory.getCategory(new_category->getUUID());
-		if (NULL == curr_cat)
+		if (!curr_cat)
 		{
 			LL_WARNS("Inventory") << "Failed to update unknown category " << new_category->getUUID() << LL_ENDL;
 		}
-- 
cgit v1.2.3