From 54c4b1de830839a5d86d36e4862c008e30de5c75 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Liru=20F=C3=A6rs?= Date: Tue, 22 Oct 2019 21:00:17 -0400 Subject: [PATCH] Fix the common crash, not quite sure why LL doesn't get this one This fix does a few things: 1. LLMaterialID initializing an LLSD implicitly from a uuid and thus not having it be a Binary, and not overriding LLSD::asBinary, UUIDs are now checked for when receiving an LLSD in constructor 2. Implicitly using a UUID shortcuts to just calling set with the mData. --- indra/llprimitive/llmaterialid.cpp | 7 +++++-- indra/llprimitive/llmaterialid.h | 1 + 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/indra/llprimitive/llmaterialid.cpp b/indra/llprimitive/llmaterialid.cpp index fc72961ea..81b457542 100644 --- a/indra/llprimitive/llmaterialid.cpp +++ b/indra/llprimitive/llmaterialid.cpp @@ -42,8 +42,11 @@ LLMaterialID::LLMaterialID() LLMaterialID::LLMaterialID(const LLSD& pMaterialID) { - llassert(pMaterialID.isBinary()); - parseFromBinary(pMaterialID.asBinary()); + llassert(pMaterialID.isBinary() || pMaterialID.isUUID()); + if (pMaterialID.isUUID()) + set(pMaterialID.asUUID().mData); + else + parseFromBinary(pMaterialID.asBinary()); } LLMaterialID::LLMaterialID(const LLSD::Binary& pMaterialID) diff --git a/indra/llprimitive/llmaterialid.h b/indra/llprimitive/llmaterialid.h index 275939032..1a086e23b 100644 --- a/indra/llprimitive/llmaterialid.h +++ b/indra/llprimitive/llmaterialid.h @@ -36,6 +36,7 @@ class LLMaterialID { public: LLMaterialID(); + LLMaterialID(const LLUUID& id) { set(id.mData); } LLMaterialID(const LLSD& pMaterialID); LLMaterialID(const LLSD::Binary& pMaterialID); LLMaterialID(const void* pMemory);