Make empty label names fail syntax checking
Previously, writing a single ':' on a line would cause the program to crash,
given that no checks were made to check whether the contents left of ':'
actually contained any label definition.
MODIFY
src/syntaxhighlighter.cpp
src/syntaxhighlighter.cpp
@@ -623,6 +623,9 @@ QString SyntaxHighlighter::checkSyntax(const QString& input) {
// Label detected - check if already defined, else add to label definitions
QStringList splitFirst = string.split(':');
string = splitFirst[0]; // get label
+ if (string.isEmpty()) {
+ return QString("Empty label name");
+ }
// Update map entries at given block
if (m_labelPosMap.contains(string) && m_labelPosMap[string] != pos) {
// duplicate label found

Make empty label names fail syntax checking

Previously, writing a single ':' on a line would cause the program to crash,
given that no checks were made to check whether the contents left of ':'
actually contained any label definition.