diff options
author | Jonathan "Geenz" Goodman <geenz@lindenlab.com> | 2025-05-28 11:52:16 -0400 |
---|---|---|
committer | Jonathan "Geenz" Goodman <geenz@lindenlab.com> | 2025-05-28 11:52:16 -0400 |
commit | fe4f85e587fc01319f0570541394eeca57273ba2 (patch) | |
tree | a3abfa235b1aad022fa5d262a60d639282635bc8 /indra/llui/lllineeditor.cpp | |
parent | aeefc73129978f6f2c1ba8caaff2750eff2cfbb3 (diff) | |
parent | de8275b14b30bf754cdba1da867cb2e6c2783639 (diff) |
Merge remote-tracking branch 'origin/main' into geenz/2025.04-to-develop
Diffstat (limited to 'indra/llui/lllineeditor.cpp')
-rw-r--r-- | indra/llui/lllineeditor.cpp | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/indra/llui/lllineeditor.cpp b/indra/llui/lllineeditor.cpp index 7a923b98df..b534c8d4e8 100644 --- a/indra/llui/lllineeditor.cpp +++ b/indra/llui/lllineeditor.cpp @@ -2508,9 +2508,24 @@ void LLLineEditor::resetPreedit() if (hasPreeditString()) { const S32 preedit_pos = mPreeditPositions.front(); - mText.erase(preedit_pos, mPreeditPositions.back() - preedit_pos); - mText.insert(preedit_pos, mPreeditOverwrittenWString); - setCursor(preedit_pos); + const S32 end = mPreeditPositions.back(); + const S32 len = end - preedit_pos; + const S32 size = mText.length(); + if (preedit_pos < size + && end <= size + && preedit_pos >= 0 + && len > 0) + { + mText.erase(preedit_pos, len); + mText.insert(preedit_pos, mPreeditOverwrittenWString); + setCursor(preedit_pos); + } + else + { + LL_WARNS() << "Index out of bounds. Start: " << preedit_pos + << ", end:" << end + << ", full string length: " << size << LL_ENDL; + } mPreeditWString.clear(); mPreeditOverwrittenWString.clear(); |