From ef135cc549c4b6b5a1fba9b6119487172620bd07 Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Tue, 10 Dec 2019 13:42:10 +0100 Subject: ProjectExplorer: Fix crash One must not call std::next() on a non-dereferenceable iterator. Change-Id: Id40341f808a3781f91f8aef1930bb76a397e8053 Reviewed-by: hjk --- src/plugins/projectexplorer/projectmacro.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 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 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); -- cgit v1.2.1