diff options
author | Jonathan "Geenz" Goodman <geenz@lindenlab.com> | 2025-05-28 11:36:40 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-05-28 11:36:40 -0400 |
commit | de8275b14b30bf754cdba1da867cb2e6c2783639 (patch) | |
tree | 77022d8d0348d5e99f54966193746fb1472d7ce2 /indra/llui/lllineeditor.cpp | |
parent | cf2b4dbfb280986cf859b12fd55158d7b9e0ac3d (diff) | |
parent | fe55c7815cde70c046467edfb651659af056cefc (diff) |
Merge pull request #3861 from secondlife/release/2025.04
Release/2025.04
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 66b274c33f..45dab88e87 100644 --- a/indra/llui/lllineeditor.cpp +++ b/indra/llui/lllineeditor.cpp @@ -2505,9 +2505,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(); |