From a0c7a7ecdc7b9fb53fa1175babf0d8497a3e9112 Mon Sep 17 00:00:00 2001 From: Mnikolenko Productengine Date: Thu, 3 Nov 2022 13:18:14 +0200 Subject: SL-18548 fix for crash when trying to Save material without caps --- indra/newview/llmaterialeditor.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'indra/newview/llmaterialeditor.cpp') diff --git a/indra/newview/llmaterialeditor.cpp b/indra/newview/llmaterialeditor.cpp index 00105c1e8f..397a302069 100644 --- a/indra/newview/llmaterialeditor.cpp +++ b/indra/newview/llmaterialeditor.cpp @@ -883,6 +883,11 @@ static U32 write_texture(const LLUUID& id, tinygltf::Model& model) void LLMaterialEditor::onClickSave() { + if (!capabilitiesAvalaible()) + { + LLNotificationsUtil::add("MissingMaterialCaps"); + return; + } if (!can_afford_transaction(mExpectedUploadCost)) { LLSD args; @@ -2809,3 +2814,17 @@ void LLMaterialEditor::loadDefaults() setFromGltfModel(model_in, 0, true); } +bool LLMaterialEditor::capabilitiesAvalaible() +{ + const LLViewerRegion* region = gAgent.getRegion(); + if (!region) + { + LL_WARNS("MaterialEditor") << "Not connected to a region, cannot save material." << LL_ENDL; + return false; + } + std::string agent_url = region->getCapability("UpdateMaterialAgentInventory"); + std::string task_url = region->getCapability("UpdateMaterialTaskInventory"); + + return (!agent_url.empty() && !task_url.empty()); +} + -- cgit v1.2.3