fix: add checks before reading from value
Signed-off-by: ComixHe <heyuming@deepin.org>
This commit is contained in:
parent
ff5f2062c3
commit
e61c8ae17a
@ -165,16 +165,25 @@ QVariant ApplicationManager1Storage::readApplicationValue(const QString &appId,
|
||||
const QString &groupName,
|
||||
const QString &valueKey) const noexcept
|
||||
{
|
||||
if (!m_data.contains(appId)) {
|
||||
return {};
|
||||
}
|
||||
auto app = m_data.constFind(appId)->toObject();
|
||||
if (app.isEmpty()) {
|
||||
return {};
|
||||
}
|
||||
|
||||
if (!app.contains(groupName)) {
|
||||
return {};
|
||||
}
|
||||
auto group = app.constFind(groupName)->toObject();
|
||||
if (group.isEmpty()) {
|
||||
return {};
|
||||
}
|
||||
|
||||
if (!group.contains(valueKey)) {
|
||||
return {};
|
||||
}
|
||||
auto val = group.constFind(valueKey);
|
||||
if (val->isNull()) {
|
||||
return {};
|
||||
|
Loading…
Reference in New Issue
Block a user