diff options
author | Andrey Kleshchev <andreykproductengine@lindenlab.com> | 2025-08-20 20:33:59 +0300 |
---|---|---|
committer | Andrey Kleshchev <117672381+akleshchev@users.noreply.github.com> | 2025-08-20 22:32:42 +0300 |
commit | 787b63f4c29f6ef56f355ec80084458a1bbcfb35 (patch) | |
tree | d8067fc99f6c699e3d15510c8521a32102f5cb30 /indra/llui/lltextbase.cpp | |
parent | e01c4477450857be7b20ffd7db402738fad31946 (diff) |
#3922 Crash on removeStringNoUndo
Diffstat (limited to 'indra/llui/lltextbase.cpp')
-rw-r--r-- | indra/llui/lltextbase.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp index 7007049e1c..382847d68f 100644 --- a/indra/llui/lltextbase.cpp +++ b/indra/llui/lltextbase.cpp @@ -1069,6 +1069,14 @@ S32 LLTextBase::insertStringNoUndo(S32 pos, const LLWString &wstr, LLTextBase::s S32 LLTextBase::removeStringNoUndo(S32 pos, S32 length) { + S32 text_length = (S32)getLength(); + if (pos >= text_length || pos < 0) + { + return 0; // nothing to remove + } + // Clamp length to not go past the end of the text + length = std::min(length, text_length - pos); + beforeValueChange(); segment_set_t::iterator seg_iter = getSegIterContaining(pos); while(seg_iter != mSegments.end()) |