From 3d4b5c0269d3ca9a42a5f8bf37f4a86972d4836d Mon Sep 17 00:00:00 2001 From: Andre Hartmann Date: Sat, 17 Apr 2021 14:39:20 +0200 Subject: [PATCH] VCS: Fix second line commit message verification For commit messages consisting of only two lines, no warning was shown when the second line was not empty. Now a warning is print for: First Second Third as well as: First Second Change-Id: Ibf19bc46465446f1634f9fdc783bd194b837d5ec Reviewed-by: Orgad Shaneh --- src/plugins/vcsbase/submiteditorwidget.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/plugins/vcsbase/submiteditorwidget.cpp b/src/plugins/vcsbase/submiteditorwidget.cpp index 714dbe59d3f..14792da7d0d 100644 --- a/src/plugins/vcsbase/submiteditorwidget.cpp +++ b/src/plugins/vcsbase/submiteditorwidget.cpp @@ -519,8 +519,10 @@ void SubmitEditorWidget::verifyDescription() int secondLineLength = 0; if (subjectLength >= 0) { const int secondLineStart = subjectLength + 1; - secondLineLength = d->m_description.indexOf(newLine, secondLineStart) - - secondLineStart; + int secondLineEnd = d->m_description.indexOf(newLine, secondLineStart); + if (secondLineEnd == -1) + secondLineEnd = descriptionLength; + secondLineLength = secondLineEnd - secondLineStart; } else { subjectLength = descriptionLength; }