From 3fde31b61026f9052243a5a716dbc0a6419880ae Mon Sep 17 00:00:00 2001
From: Andrey Kleshchev <andreykproductengine@lindenlab.com>
Date: Thu, 2 Jul 2020 18:36:19 +0300
Subject: [PATCH] SL-12688 Fixed Warning

---
 indra/newview/llpanelface.cpp | 50 ++++++++++++++++++-----------------
 1 file changed, 26 insertions(+), 24 deletions(-)

diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp
index 091ea3764d8..a3f9acb85ac 100644
--- a/indra/newview/llpanelface.cpp
+++ b/indra/newview/llpanelface.cpp
@@ -2911,18 +2911,6 @@ void LLPanelFace::onCopyTexture()
                         from_library = true;
                     }
 
-                    if (id.isNull()
-                        || (!full_perm && item_id.isNull()))
-                    {
-                        if (!LLLocalBitmapMgr::getInstance()->isLocal(id))
-                        {
-                            te_data["te"].erase("imageid");
-                            te_data["te"]["imageid"] = LLUUID(gSavedSettings.getString("DefaultObjectTexture"));
-                        }
-                        te_data["te"]["itemfullperm"] = true;
-                        te_data["te"]["fromlibrary"] = true;
-                    }
-                    else
                     {
                         te_data["te"]["itemfullperm"] = full_perm;
                         te_data["te"]["fromlibrary"] = from_library; 
@@ -3076,26 +3064,40 @@ void LLPanelFace::onPasteTexture()
     for (; iter != end; ++iter)
     {
         const LLSD& te_data = *iter;
-        if (te_data.has("te"))
+        if (te_data.has("te") && te_data["te"].has("imageid"))
         {
             bool full_perm = te_data["te"].has("itemfullperm") && te_data["te"]["itemfullperm"].asBoolean();
             full_perm_object &= full_perm;
-            if (!full_perm && te_data["te"].has("imageitemid"))
+            if (!full_perm)
             {
-                LLUUID item_id = te_data["te"]["imageitemid"].asUUID();
-                if (item_id.notNull())
+                if (te_data["te"].has("imageitemid"))
                 {
-                    LLViewerInventoryItem* itemp = gInventory.getItem(item_id);
-                    if (!itemp)
+                    LLUUID item_id = te_data["te"]["imageitemid"].asUUID();
+                    if (item_id.notNull())
                     {
-                        // image might be in object's inventory, but it can be not up to date
-                        LLSD notif_args;
-                        static std::string reason = getString("paste_error_inventory_not_found");
-                        notif_args["REASON"] = reason;
-                        LLNotificationsUtil::add("FacePasteFailed", notif_args);
-                        return;
+                        LLViewerInventoryItem* itemp = gInventory.getItem(item_id);
+                        if (!itemp)
+                        {
+                            // image might be in object's inventory, but it can be not up to date
+                            LLSD notif_args;
+                            static std::string reason = getString("paste_error_inventory_not_found");
+                            notif_args["REASON"] = reason;
+                            LLNotificationsUtil::add("FacePasteFailed", notif_args);
+                            return;
+                        }
                     }
                 }
+                else
+                {
+                    // Item was not found on 'copy' stage
+                    // Since this happened at copy, might be better to either show this
+                    // at copy stage or to drop clipboard here
+                    LLSD notif_args;
+                    static std::string reason = getString("paste_error_inventory_not_found");
+                    notif_args["REASON"] = reason;
+                    LLNotificationsUtil::add("FacePasteFailed", notif_args);
+                    return;
+                }
             }
         }
     }
-- 
GitLab