From 8c092570fcd1330dd916f31d46e8472b7817ec80 Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Wed, 9 Oct 2019 15:21:13 +0200 Subject: Fix warning about out of bounds access in QString::operator[] Fixes runtime warnings that got triggered by change c2d2757bccc68e1b981df059786c2e76f2969530. Change-Id: I50620b179de8608f45d6f2ef053eeb8b1e10ae43 Reviewed-by: Simon Hausmann --- src/gui/text/qtextodfwriter.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/gui') diff --git a/src/gui/text/qtextodfwriter.cpp b/src/gui/text/qtextodfwriter.cpp index 9721243454..6d23866392 100644 --- a/src/gui/text/qtextodfwriter.cpp +++ b/src/gui/text/qtextodfwriter.cpp @@ -358,7 +358,7 @@ void QTextOdfWriter::writeBlock(QXmlStreamWriter &writer, const QTextBlock &bloc int precedingSpaces = 0; int exportedIndex = 0; for (int i=0; i <= fragmentText.count(); ++i) { - QChar character = fragmentText[i]; + QChar character = (i == fragmentText.count() ? QChar() : fragmentText.at(i)); bool isSpace = character.unicode() == ' '; // find more than one space. -> -- cgit v1.2.3 From ba26496647bca4b37fc2319b553b95966823b941 Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Tue, 8 Oct 2019 13:16:00 +0200 Subject: Don't crash when calling jumpToFrame() on an empty QMovie Properly return an invalid frame when calling jumpToFrame() with a non existent frame number. Fixes: QTBUG-79029 Change-Id: Ic40f4a6de3106fab42c0bb6c961194be47b04e31 Reviewed-by: Eirik Aavitsland --- src/gui/image/qmovie.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/gui') diff --git a/src/gui/image/qmovie.cpp b/src/gui/image/qmovie.cpp index 79203c7b98..f03c8836df 100644 --- a/src/gui/image/qmovie.cpp +++ b/src/gui/image/qmovie.cpp @@ -416,7 +416,7 @@ QFrameInfo QMoviePrivate::infoForFrame(int frameNumber) } else { // We've read all frames now. Return an end marker haveReadAll = true; - return QFrameInfo::endMarker(); + return frameNumber == greatestFrameNumber + 1 ? QFrameInfo::endMarker() : QFrameInfo(); } } } -- cgit v1.2.3