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);
|
auto CGPSlices = CGP.split('/', Qt::SkipEmptyParts);
|
||||||
|
if (CGPSlices.isEmpty()) {
|
||||||
|
qCritical() << "invalid cgroups path,abort.";
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
if (CGPSlices.first() != "user.slice") {
|
if (CGPSlices.first() != "user.slice") {
|
||||||
qWarning() << "unrecognized process.";
|
qWarning() << "unrecognized process.";
|
||||||
return {};
|
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()) {
|
if (processUIDStr.isEmpty()) {
|
||||||
qWarning() << "no uid found.";
|
qWarning() << "no uid found.";
|
||||||
|
@ -863,7 +863,7 @@ LaunchTask ApplicationService::unescapeExec(const QString &str, const QStringLis
|
|||||||
}
|
}
|
||||||
|
|
||||||
auto list = matcher.capturedTexts();
|
auto list = matcher.capturedTexts();
|
||||||
if (list.count() > 1) {
|
if (list.count() != 1) {
|
||||||
qWarning() << "invalid exec format, all filed code will be ignored.";
|
qWarning() << "invalid exec format, all filed code will be ignored.";
|
||||||
for (const auto &code : list) {
|
for (const auto &code : list) {
|
||||||
execList.removeOne(code);
|
execList.removeOne(code);
|
||||||
|
@ -473,6 +473,10 @@ inline QString getCurrentDesktop()
|
|||||||
qWarning() << "multi-DE is detected, use first value.";
|
qWarning() << "multi-DE is detected, use first value.";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (desktops.isEmpty()) {
|
||||||
|
return "DDE";
|
||||||
|
}
|
||||||
|
|
||||||
return desktops.first();
|
return desktops.first();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user