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: [PATCH] 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(-)

diff --git a/indra/newview/llaisapi.cpp b/indra/newview/llaisapi.cpp
index da66ea357a8..623458cb08b 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
-- 
GitLab