From 11ed48abd15d0fcc1e41a9a122a081785d82f917 Mon Sep 17 00:00:00 2001
From: andreykproductengine <akleshchev@productengine.com>
Date: Tue, 14 Apr 2015 21:21:29 +0300
Subject: MAINT-5097 FIXED crash in LLFloaterPay::onGive

---
 indra/newview/llfloaterpay.cpp                     | 23 ++++++++++++++++++----
 .../newview/skins/default/xui/en/notifications.xml | 11 +++++++++++
 2 files changed, 30 insertions(+), 4 deletions(-)

(limited to 'indra/newview')

diff --git a/indra/newview/llfloaterpay.cpp b/indra/newview/llfloaterpay.cpp
index 172f81d078..31245db344 100755
--- a/indra/newview/llfloaterpay.cpp
+++ b/indra/newview/llfloaterpay.cpp
@@ -367,7 +367,8 @@ void LLFloaterPay::payViaObject(money_callback callback, LLSafeHandle<LLObjectSe
 	LLSelectNode* node = selection->getFirstRootNode();
 	if (!node) 
 	{
-		//FIXME: notify user object no longer exists
+		// object no longer exists
+		LLNotificationsUtil::add("PayObjectFailed");
 		floater->closeFloater();
 		return;
 	}
@@ -491,12 +492,22 @@ void LLFloaterPay::onGive(void* data)
 		}
 		if (amount > PAY_AMOUNT_NOTIFICATION && gStatusBar && gStatusBar->getBalance() > amount)
 		{
-			LLUUID payee_id;
-			BOOL is_group;
+			LLUUID payee_id = LLUUID::null;
+			BOOL is_group = false;
 			if (floater->mObjectSelection.notNull())
 			{
 				LLSelectNode* node = floater->mObjectSelection->getFirstRootNode();
-				node->mPermissions->getOwnership(payee_id, is_group);
+				if (node)
+				{
+					node->mPermissions->getOwnership(payee_id, is_group);
+				}
+				else
+				{
+					// object no longer exists
+					LLNotificationsUtil::add("PayObjectFailed");
+					floater->closeFloater();
+					return;
+				}
 			}
 			else
 			{
@@ -562,6 +573,10 @@ void LLFloaterPay::give(S32 amount)
 					msg->sendReliable( region->getHost() );
 				}
 			}
+			else
+			{
+				LLNotificationsUtil::add("PayObjectFailed");
+			}
 		}
 		else
 		{
diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml
index 632396d58c..28565a85c6 100755
--- a/indra/newview/skins/default/xui/en/notifications.xml
+++ b/indra/newview/skins/default/xui/en/notifications.xml
@@ -5275,6 +5275,17 @@ Warning: The &apos;Pay object&apos; click action has been set, but it will only
      yestext="Pay"/>
   </notification>
 
+  <notification
+   icon="alertmodal.tga"
+   name="PayObjectFailed"
+   type="alertmodal">
+    Payment failed: object was not found.
+    <tag>fail</tag>
+    <usetemplate
+     name="okbutton"
+     yestext="OK"/>
+  </notification>
+
   <notification
    icon="alertmodal.tga"
    name="OpenObjectCannotCopy"
-- 
cgit v1.2.3