diff --git a/src/libs/cplusplus/ExpressionUnderCursor.cpp b/src/libs/cplusplus/ExpressionUnderCursor.cpp
index 3886d03bd0c001272bb3275cc0bdd90e2a4fd099..d8c7fc55fbf714bfc88704d162a6bb2babd512a7 100644
--- a/src/libs/cplusplus/ExpressionUnderCursor.cpp
+++ b/src/libs/cplusplus/ExpressionUnderCursor.cpp
@@ -136,7 +136,7 @@ int ExpressionUnderCursor::startOfExpression_helper(BackwardsScanner &tk, int in
             //     [receiver messageParam1:expression messageParam2:expression messageParam3
             // ... etc
             int i = index - 1;
-            while (tk[i].isNot(T_EOF_SYMBOL)) {
+            while (i >= 0 && tk[i].isNot(T_EOF_SYMBOL)) {
                 if (tk[i].is(T_LBRACKET))
                     break;
                 if (tk[i].is(T_LBRACE) || tk[i].is(T_RBRACE))