summaryrefslogtreecommitdiff
path: root/indra/llui/lltextbase.cpp
diff options
context:
space:
mode:
authorRye <rye@alchemyviewer.org>2025-08-28 00:53:15 -0400
committerRye <rye@alchemyviewer.org>2025-08-28 00:53:15 -0400
commit96ff5f8e70396b53168682c4a1addb9a61d45e7c (patch)
treec874c67c68f2412c0e1cc630ffbb6bf3819c229c /indra/llui/lltextbase.cpp
parent77d71dec863e28323bcafb1573cd1ecd54fe3049 (diff)
parentb2468342072f1e8b0fa2029d01918f74cdd6d4a8 (diff)
Merge branch 'develop' of github.com:secondlife/viewer into rye/infinitemac
Diffstat (limited to 'indra/llui/lltextbase.cpp')
-rw-r--r--indra/llui/lltextbase.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp
index d5755ae4b6..ffaa09fd8c 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())