From 0c0b66388fddb70c4e9ac7660ba5dd709bc4cfc9 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Thu, 27 Oct 2022 01:42:45 +0300 Subject: SL-18465 Crash opening Material Editor --- indra/newview/llpreview.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'indra/newview/llpreview.cpp') diff --git a/indra/newview/llpreview.cpp b/indra/newview/llpreview.cpp index fc2de4844e..b9b2279e77 100644 --- a/indra/newview/llpreview.cpp +++ b/indra/newview/llpreview.cpp @@ -115,8 +115,11 @@ const LLInventoryItem *LLPreview::getItem() const } else if (mObjectUUID.isNull()) { - // it's an inventory item, so get the item. - item = gInventory.getItem(mItemUUID); + if (mItemUUID.notNull()) + { + // it's an inventory item, so get the item. + item = gInventory.getItem(mItemUUID); + } } else { -- cgit v1.2.3 From ca6f465088be904fa5b85297396227f905792a3b Mon Sep 17 00:00:00 2001 From: Cosmic Linden Date: Mon, 24 Jul 2023 16:16:52 -0700 Subject: SL-20024: Disable material editor on prim when contained material is no mod --- indra/newview/llpreview.cpp | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) (limited to 'indra/newview/llpreview.cpp') diff --git a/indra/newview/llpreview.cpp b/indra/newview/llpreview.cpp index b9b2279e77..0117db86e8 100644 --- a/indra/newview/llpreview.cpp +++ b/indra/newview/llpreview.cpp @@ -241,14 +241,22 @@ void LLPreview::refreshFromItem() // static BOOL LLPreview::canModify(const LLUUID taskUUID, const LLInventoryItem* item) { + const LLViewerObject* object = nullptr; if (taskUUID.notNull()) { - LLViewerObject* object = gObjectList.findObject(taskUUID); - if(object && !object->permModify()) - { - // No permission to edit in-world inventory - return FALSE; - } + object = gObjectList.findObject(taskUUID); + } + + return canModify(object, item); +} + +// static +BOOL LLPreview::canModify(const LLViewerObject* object, const LLInventoryItem* item) +{ + if (object && !object->permModify()) + { + // No permission to edit in-world inventory + return FALSE; } return item && gAgent.allowOperation(PERM_MODIFY, item->getPermissions(), GP_OBJECT_MANIPULATE); -- cgit v1.2.3