diff options
author | Erik Kundiman <erik@megapahit.org> | 2025-05-29 12:35:27 +0800 |
---|---|---|
committer | Erik Kundiman <erik@megapahit.org> | 2025-05-29 12:35:27 +0800 |
commit | d046d7e0e1e3ccbffb42d22fe52aa73d0c170b8e (patch) | |
tree | 7c2023e55955c9aed55db9331bae164a386a2d21 /indra/llui/lllineeditor.cpp | |
parent | 6641e36082f27faa282a0af6f88f381ffc97e179 (diff) | |
parent | 11d75418fce8372e9976b069070d9d0506766d0d (diff) |
Merge branch 'main' into 2025.05
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(); |