diff options
author | Alan Alpert <alan.alpert@nokia.com> | 2011-01-11 04:10:18 (GMT) |
---|---|---|
committer | Alan Alpert <alan.alpert@nokia.com> | 2011-01-11 04:10:18 (GMT) |
commit | 7393fa902a62e53558ffb56769d31b4d5ba77161 (patch) | |
tree | 457c2ce959c110b5d12a8af1886fd88449ce36ba | |
parent | 7ca750fad4e74929c9c34a98c19bde37747a9dc5 (diff) | |
download | Qt-7393fa902a62e53558ffb56769d31b4d5ba77161.zip Qt-7393fa902a62e53558ffb56769d31b4d5ba77161.tar.gz Qt-7393fa902a62e53558ffb56769d31b4d5ba77161.tar.bz2 |
Don't crash if cursor at the end.
77cba04c2 assumed a level of bounds checking in QTextLayout that does
not exist.
Task-number: qtbug-15818
Reviewed-by: Michael Brasser
-rw-r--r-- | src/gui/widgets/qlinecontrol.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/gui/widgets/qlinecontrol.cpp b/src/gui/widgets/qlinecontrol.cpp index 12607c1..9abbfac 100644 --- a/src/gui/widgets/qlinecontrol.cpp +++ b/src/gui/widgets/qlinecontrol.cpp @@ -541,7 +541,10 @@ void QLineControl::draw(QPainter *painter, const QPoint &offset, const QRect &cl */ void QLineControl::selectWordAtPos(int cursor) { - int c = m_textLayout.previousCursorPosition(cursor+1, QTextLayout::SkipWords); + int next = cursor + 1; + if(next > end()) + --next; + int c = m_textLayout.previousCursorPosition(next, QTextLayout::SkipWords); moveCursor(c, false); // ## text layout should support end of words. int end = m_textLayout.nextCursorPosition(c, QTextLayout::SkipWords); |