From b33d4053eca36480098f764c7b7ad8f3516641ea Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev <117672381+akleshchev@users.noreply.github.com> Date: Tue, 18 Aug 2026 00:30:13 +0300 Subject: #1841 Fix viewer attempting to parse joystick key string into an llsd Key already is an LLSD::String and needs no further parsing. This parsing was added for command line handling and should be done explicitly in command line's parser. Also extended event listeners, there should be no ambiguity in what kind of data we are passing. --- indra/llxml/llcontrol.cpp | 38 ++++++++++++++++++++++++-------------- 1 file changed, 24 insertions(+), 14 deletions(-) (limited to 'indra/llxml/llcontrol.cpp') diff --git a/indra/llxml/llcontrol.cpp b/indra/llxml/llcontrol.cpp index 84d03a6d0c..eccf672e46 100644 --- a/indra/llxml/llcontrol.cpp +++ b/indra/llxml/llcontrol.cpp @@ -192,20 +192,6 @@ LLSD LLControlVariable::getComparableValue(const LLSD& value) storable_value = false; } } - else if (TYPE_LLSD == type() && value.isString()) - { - LLPointer parser = new LLSDNotationParser; - LLSD result; - std::stringstream value_stream(value.asString()); - if (parser->parse(value_stream, result, LLSDSerialize::SIZE_UNLIMITED) != LLSDParser::PARSE_FAILURE) - { - storable_value = result; - } - else - { - storable_value = value; - } - } else { storable_value = value; @@ -735,6 +721,30 @@ void LLControlGroup::setLLSD(std::string_view name, const LLSD& val) set(name, val); } +bool LLControlVariable::setValueFromNotation(const std::string& notation, bool saved_value) +{ + if (mType == TYPE_LLSD) + { + LLPointer parser = new LLSDNotationParser; + LLSD result; + std::stringstream value_stream(notation); + S32 parse_count = parser->parse(value_stream, result, LLSDSerialize::SIZE_UNLIMITED); + if (parse_count != LLSDParser::PARSE_FAILURE) + { + setValue(result, saved_value); + return true; + } + LL_WARNS("Controls") << "Failed to parse LLSD notation for control '" + << mName << "': " << notation << LL_ENDL; + } + else + { + LL_WARNS("Controls") << "setValueFromNotation() called on non-LLSD control '" + << mName << "' (type " << LLControlGroup::typeEnumToString(mType) << "); ignoring." << LL_ENDL; + } + return false; +} + void LLControlGroup::setUntypedValue(std::string_view name, const LLSD& val) { if (name.empty()) -- cgit v1.3