viewer#1018 Crash at insertStringNoUndo

getEditableIndex retuns pos as is if only one segment is present
master
Andrey Kleshchev 2024-03-20 22:06:59 +02:00 committed by Andrey Kleshchev
parent 4ee22b3347
commit 73318bbc6a
1 changed files with 8 additions and 1 deletions

View File

@ -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);