From abf1bf79f2d45ba42389397f9013d5552f7d672d Mon Sep 17 00:00:00 2001
From: Gilbert Gonzales <gilbert@lindenlab.com>
Date: Thu, 21 Mar 2013 16:16:54 -0700
Subject: [PATCH] CHUI-881 ([CHUIBUG]Viewer crashes when user drag and drop the
 participant from the people floater to the one of the tool bars): Problem was
 that the item dragged from the people list was not of type inventoryitem.
 Instead of casting to an inventoryitem and checking if the item being dragged
 is a widgit, instead look at the cargo type (which also specifies that the
 dragged item is a widgit but doesn't need to typecast).

---
 indra/llui/lltoolbar.cpp | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/indra/llui/lltoolbar.cpp b/indra/llui/lltoolbar.cpp
index b9256dd890d..1c74395c666 100644
--- a/indra/llui/lltoolbar.cpp
+++ b/indra/llui/lltoolbar.cpp
@@ -1059,10 +1059,9 @@ BOOL LLToolBar::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,
 	// Convert drag position into insert position and rank 
 	if (!isReadOnly() && handled && !drop)
 	{
-		LLInventoryItem* inv_item = (LLInventoryItem*)cargo_data;
-		LLAssetType::EType type = inv_item->getType();
-		if (type == LLAssetType::AT_WIDGET)
+		if (cargo_type == DAD_WIDGET)
 		{
+			LLInventoryItem* inv_item = (LLInventoryItem*)cargo_data;
 			LLCommandId dragged_command(inv_item->getUUID());
 			int orig_rank = getRankFromPosition(dragged_command);
 			mDragRank = getRankFromPosition(x, y);
-- 
GitLab