summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorYuchen Deng <loaden@gmail.com>2011-12-31 19:26:45 +0800
committerQt by Nokia <qt-info@nokia.com>2012-01-07 17:25:00 +0100
commit0277f14f48539d5f9d443c7d4135a54d4a5e2a62 (patch)
tree25053c09e479d038925ccb154d5714f5088e0625 /src/gui
parentb3ce4470ae2ece0c03c66684ca3d9dd13955786b (diff)
Avoiding crash when insert preEditString
We will insert an preEditString by QInputMethodEvent See: Task-number: QTCREATORBUG-5633 Task-number: QTCREATORBUG-6082 Change-Id: I8cfc7ab2543455dfdff8ec3df983d384513453e0 Reviewed-by: Robin Burchell <robin+qt@viroteck.net> Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/text/qtextcursor.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/gui/text/qtextcursor.cpp b/src/gui/text/qtextcursor.cpp
index 10bbff3671..6bbf1be0e3 100644
--- a/src/gui/text/qtextcursor.cpp
+++ b/src/gui/text/qtextcursor.cpp
@@ -495,6 +495,8 @@ bool QTextCursorPrivate::movePosition(QTextCursor::MoveOperation op, QTextCursor
break;
}
newPosition = blockIt.position() + line.textStart() + line.textLength();
+ if (newPosition >= priv->length())
+ newPosition = priv->length() - 1;
if (line.lineNumber() < layout->lineCount() - 1) {
const QString text = blockIt.text();
// ###### this relies on spaces being the cause for linebreaks.