diff --git a/src/libs/utils/uncommentselection.cpp b/src/libs/utils/uncommentselection.cpp
index facae876716f8d903673d0b1aaee34ecbc6e501e..06fe12ce31f99bd4a6202b9e7b739c1dafc90859 100644
--- a/src/libs/utils/uncommentselection.cpp
+++ b/src/libs/utils/uncommentselection.cpp
@@ -154,7 +154,7 @@ void Utils::unCommentSelection(QPlainTextEdit *edit, const CommentDefinition &de
             start -= multiLineStartLength;
         }
 
-        bool hasSelStart = (startPos < startText.length() - multiLineStartLength
+        bool hasSelStart = (startPos <= startText.length() - multiLineStartLength
                             && isComment(startText,
                                          startPos,
                                          definition,