diff --git a/src/libs/cplusplus/pp-engine.cpp b/src/libs/cplusplus/pp-engine.cpp
index 80832275804719a750f472fa9564e4380f319654..372926f59755cb51d82c8bca939498362830d22a 100644
--- a/src/libs/cplusplus/pp-engine.cpp
+++ b/src/libs/cplusplus/pp-engine.cpp
@@ -771,7 +771,11 @@ void Preprocessor::preprocess(const QString &fileName, const QByteArray &source,
         } else {
 
             if (_dot->whitespace) {
-                const unsigned endOfPreviousToken = (_dot - 1)->end();
+                unsigned endOfPreviousToken = 0;
+
+                if (_dot != _tokens.constBegin())
+                    endOfPreviousToken = (_dot - 1)->end();
+
                 const unsigned beginOfToken = _dot->begin();
 
                 const char *start = _source.constBegin() + endOfPreviousToken;