mirror of
https://github.com/sqlitebrowser/sqlitebrowser.git
synced 2026-01-19 18:40:13 -06:00
SqliteTableModel: Don't crash when query contains ';'
Fix a bug in SqliteTableModel that caused the application to crash when the SQL query contained a semicolon somewhere in the middle of the string. This was caused by an error in the rtrimChar function which returned everything left of the first semicolon. The new implementation only removed trailing characters.
This commit is contained in:
@@ -36,9 +36,9 @@ void SqliteTableModel::setTable(const QString& table)
|
||||
namespace {
|
||||
QString rtrimChar(const QString& s, QChar c) {
|
||||
QString r = s.trimmed();
|
||||
int i = r.length() - 1;
|
||||
for(; i >= 0 && r.at(i) != c; --i);
|
||||
return r.left(i);
|
||||
while(r.endsWith(c))
|
||||
r.chop(1);
|
||||
return r;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user