Fix crash with invalid pre-edit position.
Ensure the script item position is within the bounds of the text block when adjusted to compensate for pre-edit text. Change-Id: I2c745bf08afc0d9bc3aba27c24c2a123af017dc6 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>
This commit is contained in:
parent
efdadbb3d6
commit
5a02c2115c
@ -2185,7 +2185,7 @@ int QTextEngine::formatIndex(const QScriptItem *si) const
|
||||
int pos = si->position;
|
||||
if (specialData && si->position >= specialData->preeditPosition) {
|
||||
if (si->position < specialData->preeditPosition + specialData->preeditText.length())
|
||||
pos = qMax(specialData->preeditPosition - 1, 0);
|
||||
pos = qMax(qMin(block.length(), specialData->preeditPosition) - 1, 0);
|
||||
else
|
||||
pos -= specialData->preeditText.length();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user