summaryrefslogtreecommitdiff
path: root/indra/llui/lltextbase.cpp
diff options
context:
space:
mode:
authorErik Kundiman <erik@megapahit.org>2025-08-21 06:34:05 +0800
committerErik Kundiman <erik@megapahit.org>2025-08-21 06:34:05 +0800
commitefef28c1f51c4b8ec53c3742961a11b8c706f17f (patch)
tree0d16b22feec42da965f522074f604d02bf6487a4 /indra/llui/lltextbase.cpp
parentb3e00b61a9126a54383cc52c356d0c488d2ec91d (diff)
parent787b63f4c29f6ef56f355ec80084458a1bbcfb35 (diff)
Merge tag 'Second_Life_Release#787b63f4-2025.06' into 2025.06
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 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())