mirror of
https://github.com/KDE/konsole.git
synced 2025-12-23 23:38:08 -05:00
Check lastColonPos is valid before using it
This commit is contained in:
@@ -700,10 +700,13 @@ private:
|
||||
}
|
||||
|
||||
const QString data = QString::fromUtf8(cGroupFile.readAll());
|
||||
const qsizetype lastColonPos = data.lastIndexOf(QLatin1Char(':'));
|
||||
if (lastColonPos < 0) {
|
||||
return QString();
|
||||
}
|
||||
|
||||
const QString cGroupPath(data.mid(data.lastIndexOf(QLatin1Char(':')) + 1));
|
||||
|
||||
return QString(QStringLiteral("/sys/fs/cgroup") + cGroupPath).trimmed();
|
||||
QStringView cGroupPath(QStringView(data).mid(lastColonPos + 1).trimmed());
|
||||
return QString(QStringLiteral("/sys/fs/cgroup") + cGroupPath);
|
||||
}
|
||||
|
||||
bool createSystemdUnit(const QString &name, const VariantList &propList)
|
||||
|
||||
Reference in New Issue
Block a user