diff options
| author | Rider Linden <rider@lindenlab.com> | 2026-03-26 12:01:28 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-03-26 12:01:28 -0700 |
| commit | b45bb3186fa28bd2ebbdf8e328f3e239ee5eb4d8 (patch) | |
| tree | 79469080169d5e80cd4d2f41a91ff57ecadb38c7 /indra | |
| parent | 4df8fe0138b992d91ee9ca7abe972d41df8df00d (diff) | |
Apply suggestions from code review
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Diffstat (limited to 'indra')
| -rw-r--r-- | indra/llinventory/llinventory.cpp | 24 | ||||
| -rw-r--r-- | indra/llinventory/llinventory.h | 2 |
2 files changed, 17 insertions, 9 deletions
diff --git a/indra/llinventory/llinventory.cpp b/indra/llinventory/llinventory.cpp index c83717fef5..14bd7db617 100644 --- a/indra/llinventory/llinventory.cpp +++ b/indra/llinventory/llinventory.cpp @@ -200,19 +200,21 @@ void LLInventoryObject::setFavorite(bool favorite) void LLInventoryObject::setRuntime(std::string_view runtime) { - if (getType() == LLAssetType::AT_LSL_TEXT) - { - mRuntime = runtime; - } - else - { - mRuntime.clear(); - } + // Store the runtime unconditionally; it will be validated/cleared + // when the final asset type is known (see setType()). + mRuntime = runtime; } void LLInventoryObject::setType(LLAssetType::EType type) { mType = type; + + // Only LSL text assets are expected to have a runtime; clear any + // previously stored runtime for other asset types. + if (mType != LLAssetType::AT_LSL_TEXT) + { + mRuntime.clear(); + } } @@ -1105,6 +1107,12 @@ bool LLInventoryItem::fromLLSD(const LLSD& sd, bool is_new) { mRuntime = script_map[w].asString(); } + else + { + // Clear any stale runtime when a script block is present + // but no explicit runtime value is provided. + mRuntime.clear(); + } continue; } diff --git a/indra/llinventory/llinventory.h b/indra/llinventory/llinventory.h index ad270f317d..c22b17ab66 100644 --- a/indra/llinventory/llinventory.h +++ b/indra/llinventory/llinventory.h @@ -72,7 +72,7 @@ public: const LLUUID& getParentUUID() const; virtual const LLUUID& getThumbnailUUID() const; virtual bool getIsFavorite() const; - virtual std::string getRuntime() const; + virtual const std::string& getRuntime() const; virtual const std::string& getName() const; virtual LLAssetType::EType getType() const; LLAssetType::EType getActualType() const; // bypasses indirection for linked items |
