summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2019-10-09 15:21:13 +0200
committerLars Knoll <lars.knoll@qt.io>2019-10-09 15:58:08 +0200
commit8c092570fcd1330dd916f31d46e8472b7817ec80 (patch)
tree072d52edddf75c575a5ac8db83fc3bf63ab1721b
parenta1ea49878927dfe267416c795b50f3d5bdfa0b84 (diff)
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 <simon.hausmann@qt.io>
-rw-r--r--src/gui/text/qtextodfwriter.cpp2
1 files changed, 1 insertions, 1 deletions
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. -> <text:s text:c="2" />