diff options
author | Andrew den Exter <andrew.den-exter@nokia.com> | 2012-04-04 15:34:09 +1000 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-04-10 10:38:10 +0200 |
commit | 5a02c2115c2522847ac3388e2719de6876166e03 (patch) | |
tree | 5677ce13ab6ad58b3e7eca15041be434d61d4ffe /src | |
parent | efdadbb3d6413c909dc0c7d6c0f3713684c671c6 (diff) |
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>
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/text/qtextengine.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp index 7d366275a3..e36104370c 100644 --- a/src/gui/text/qtextengine.cpp +++ b/src/gui/text/qtextengine.cpp @@ -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(); } |