summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Kandeler <christian.kandeler@qt.io>2019-12-10 13:42:10 +0100
committerChristian Kandeler <christian.kandeler@qt.io>2019-12-10 12:48:40 +0000
commitef135cc549c4b6b5a1fba9b6119487172620bd07 (patch)
tree4f2c664c80c4a0d712e6b151e133eafb793bb4f5
parent017ed74400de56b99c6fddb6f4691ba65d35695e (diff)
downloadqt-creator-ef135cc549c4b6b5a1fba9b6119487172620bd07.tar.gz
ProjectExplorer: Fix crash
One must not call std::next() on a non-dereferenceable iterator. Change-Id: Id40341f808a3781f91f8aef1930bb76a397e8053 Reviewed-by: hjk <hjk@qt.io>
-rw-r--r--src/plugins/projectexplorer/projectmacro.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/plugins/projectexplorer/projectmacro.cpp b/src/plugins/projectexplorer/projectmacro.cpp
index 5d2824f01d..4a6ca945c9 100644
--- a/src/plugins/projectexplorer/projectmacro.cpp
+++ b/src/plugins/projectexplorer/projectmacro.cpp
@@ -166,12 +166,12 @@ QList<QByteArray> Macro::tokenizeLine(const QByteArray &line)
const auto begin = normalizedLine.begin();
auto first = std::find(normalizedLine.begin(), normalizedLine.end(), ' ');
- auto second = std::find(std::next(first), normalizedLine.end(), ' ');
const auto end = normalizedLine.end();
QList<QByteArray> tokens;
if (first != end) {
+ auto second = std::find(std::next(first), normalizedLine.end(), ' ');
tokens.append(QByteArray(begin, int(std::distance(begin, first))));
std::advance(first, 1);