summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrad Linden <46733234+brad-linden@users.noreply.github.com>2024-12-13 16:13:30 -0800
committerGitHub <noreply@github.com>2024-12-13 16:13:30 -0800
commit5b77436cf0ad749d36e8f0c60077eeb24698d644 (patch)
tree76fe43e4c22d672e7180fc6d6e3eee488d6d521c
parent67b9779d555cf749cfb9011382f261ffa84028aa (diff)
#3288 null overrides crashes (#3289)
* Fixes for secondlife/viewer#3288 override copy related crashes when overrides can be nullptr
-rw-r--r--indra/newview/llselectmgr.cpp10
-rw-r--r--indra/newview/lltooldraganddrop.cpp5
2 files changed, 10 insertions, 5 deletions
diff --git a/indra/newview/llselectmgr.cpp b/indra/newview/llselectmgr.cpp
index 7f1f90592f..fceb25b3d3 100644
--- a/indra/newview/llselectmgr.cpp
+++ b/indra/newview/llselectmgr.cpp
@@ -2251,11 +2251,15 @@ void LLSelectMgr::selectionRevertGLTFMaterials()
// Update material locally
objectp->setRenderMaterialID(te, asset_id, false /*wait for LLGLTFMaterialList update*/);
- LLGLTFMaterial* material = new LLGLTFMaterial(*nodep->mSavedGLTFOverrideMaterials[te]);
- objectp->setTEGLTFMaterialOverride(te, material);
+ LLGLTFMaterial* material = nodep->mSavedGLTFOverrideMaterials[te];
+ if (material)
+ {
+ material = new LLGLTFMaterial(*material);
+ objectp->setTEGLTFMaterialOverride(te, material);
+ }
// Enqueue update to server
- if (asset_id.notNull())
+ if (asset_id.notNull() && material)
{
// Restore overrides and base material
LLGLTFMaterialList::queueApply(objectp, te, asset_id, material);
diff --git a/indra/newview/lltooldraganddrop.cpp b/indra/newview/lltooldraganddrop.cpp
index 6be7ec2262..4efa289141 100644
--- a/indra/newview/lltooldraganddrop.cpp
+++ b/indra/newview/lltooldraganddrop.cpp
@@ -1447,9 +1447,10 @@ void LLToolDragAndDrop::dropTexture(LLViewerObject* hit_obj,
}
LLTextureEntry* te = hit_obj->getTE(hit_face);
- if (te && !remove_pbr)
+ LLGLTFMaterial * override_mat = nullptr;
+ if (te && !remove_pbr && (override_mat = te->getGLTFMaterialOverride()))
{
- LLGLTFMaterial* copy = new LLGLTFMaterial(*te->getGLTFMaterialOverride());
+ LLGLTFMaterial* copy = new LLGLTFMaterial(*override_mat);
nodep->mSavedGLTFOverrideMaterials[hit_face] = copy;
}
else