summaryrefslogtreecommitdiff
path: root/indra/llui
diff options
context:
space:
mode:
authorAndrey Kleshchev <andreykproductengine@lindenlab.com>2024-03-20 22:06:59 +0200
committerAndrey Kleshchev <117672381+akleshchev@users.noreply.github.com>2024-03-20 23:39:09 +0200
commit73318bbc6a48be00aa4d3f73cdfdba6875616f6d (patch)
tree20b05c25b420b275da93d2981663385601aec03b /indra/llui
parent4ee22b3347b78c263b040aa204cb30906dce2375 (diff)
viewer#1018 Crash at insertStringNoUndo
getEditableIndex retuns pos as is if only one segment is present
Diffstat (limited to 'indra/llui')
-rw-r--r--indra/llui/lltextbase.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp
index 61b67e346e..bb3ce49b8b 100644
--- a/indra/llui/lltextbase.cpp
+++ b/indra/llui/lltextbase.cpp
@@ -845,7 +845,14 @@ S32 LLTextBase::insertStringNoUndo(S32 pos, const LLWString &wstr, LLTextBase::s
S32 old_len = getLength(); // length() returns character length
S32 insert_len = wstr.length();
- pos = getEditableIndex(pos, true);
+ pos = getEditableIndex(pos, true);
+ if (pos > old_len)
+ {
+ pos = old_len;
+ // Should not happen,
+ // if you encounter this, check where wrong position comes from
+ llassert(false);
+ }
segment_set_t::iterator seg_iter = getEditableSegIterContaining(pos);