refact: add some checks
Signed-off-by: ComixHe <heyuming@deepin.org>
This commit is contained in:
parent
b9bbfb7f6d
commit
3d8b834e3c
@ -60,12 +60,22 @@ QString CGroupsIdentifier::parseCGroupsPath(QFile &cgroupFile) noexcept
|
||||
}
|
||||
|
||||
auto CGPSlices = CGP.split('/', Qt::SkipEmptyParts);
|
||||
if (CGPSlices.isEmpty()) {
|
||||
qCritical() << "invalid cgroups path,abort.";
|
||||
return {};
|
||||
}
|
||||
|
||||
if (CGPSlices.first() != "user.slice") {
|
||||
qWarning() << "unrecognized process.";
|
||||
return {};
|
||||
}
|
||||
auto processUIDStr = CGPSlices[1].split('.').first().split('-').last();
|
||||
|
||||
auto userSlice = CGPSlices.at(1);
|
||||
if (userSlice.isEmpty()) {
|
||||
qWarning() << "couldn't detect uid.";
|
||||
return {};
|
||||
}
|
||||
auto processUIDStr = userSlice.split('.').first().split('-').last();
|
||||
|
||||
if (processUIDStr.isEmpty()) {
|
||||
qWarning() << "no uid found.";
|
||||
|
@ -863,7 +863,7 @@ LaunchTask ApplicationService::unescapeExec(const QString &str, const QStringLis
|
||||
}
|
||||
|
||||
auto list = matcher.capturedTexts();
|
||||
if (list.count() > 1) {
|
||||
if (list.count() != 1) {
|
||||
qWarning() << "invalid exec format, all filed code will be ignored.";
|
||||
for (const auto &code : list) {
|
||||
execList.removeOne(code);
|
||||
|
@ -473,6 +473,10 @@ inline QString getCurrentDesktop()
|
||||
qWarning() << "multi-DE is detected, use first value.";
|
||||
}
|
||||
|
||||
if (desktops.isEmpty()) {
|
||||
return "DDE";
|
||||
}
|
||||
|
||||
return desktops.first();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user