QTextLayout::lineAt() to return invalid line if index is out of bounds
authorPekka Vuorela <pekka.ta.vuorela@nokia.com>
Tue, 3 Jan 2012 13:07:13 +0000 (15:07 +0200)
committerQt by Nokia <qt-info@nokia.com>
Thu, 5 Jan 2012 01:17:04 +0000 (02:17 +0100)
Change-Id: I1f93789c96f3b2335b02897ff5fc8385964d1641
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>
src/gui/text/qtextlayout.cpp

index 6cf24d1..d470c6d 100644 (file)
@@ -836,7 +836,7 @@ int QTextLayout::lineCount() const
 */
 QTextLine QTextLayout::lineAt(int i) const
 {
-    return QTextLine(i, d);
+    return i < lineCount() ? QTextLine(i, d) : QTextLine();
 }
 
 /*!