mirror of
https://github.com/sqlitebrowser/sqlitebrowser.git
synced 2026-01-19 10:20:17 -06:00
fix bug, if there is no NL in the last line comment #40
if there was no NL in the line comment we ran into an endless recursion, now we check for that corner case.
This commit is contained in:
@@ -63,8 +63,9 @@ QString removeComments(QString s)
|
||||
else if(!(!stringChars.empty() && (stringChars.last() != '\'' || stringChars.last() != '"')) || stringChars.empty())
|
||||
stringChars.push_back(s.at(i));
|
||||
} else if(stringChars.empty() && s.at(i) == '-' && lastChar == '-') {
|
||||
if(s.contains('\n'))
|
||||
return removeComments(s.remove(i-1, s.indexOf('\n', i)-i+2));
|
||||
int nextNL = s.indexOf('\n', i);
|
||||
if(nextNL >= 0)
|
||||
return removeComments(s.remove(i-1, nextNL - i + 2));
|
||||
else
|
||||
return s.left(i-1);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user