SL-18548 fix for crash when trying to Save material without caps

meow-7.2.2
Mnikolenko Productengine 2022-11-03 13:18:14 +02:00
parent 0f20cf17fd
commit a0c7a7ecdc
3 changed files with 29 additions and 0 deletions

View File

@ -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());
}

View File

@ -228,6 +228,8 @@ public:
U32 getUnsavedChangesFlags() { return mUnsavedChanges; }
bool capabilitiesAvalaible();
private:
static bool updateInventoryItem(const std::string &buffer, const LLUUID &item_id, const LLUUID &task_id);
static void createInventoryItem(const std::string &buffer, const std::string &name, const std::string &desc);

View File

@ -6856,6 +6856,14 @@ Please try again.
<tag>fail</tag>
</notification>
<notification
icon="notifytip.tga"
name="MissingMaterialCaps"
type="notifytip">
<tag>fail</tag>
Not connected to a materials capable region.
</notification>
<notification
icon="notifytip.tga"
name="ScriptMissing"