Validate JSON parsing results
Signed-off-by: Yihe Li <winmikedows@hotmail.com>
This commit is contained in:
parent
0a1001ee84
commit
50fb2db718
2 changed files with 13 additions and 12 deletions
|
@ -686,18 +686,7 @@ InstancePtr InstanceList::loadInstance(const InstanceId& id)
|
|||
}
|
||||
qDebug() << "Loaded instance" << inst->name() << "from" << inst->instanceRoot();
|
||||
|
||||
// Fixup the shortcuts by pruning all non-existing links
|
||||
auto shortcut = inst->shortcuts();
|
||||
for (auto it = shortcut.begin(); it != shortcut.end();) {
|
||||
const auto& [name, filePath, target] = *it;
|
||||
if (!QDir(filePath).exists()) {
|
||||
qWarning() << "Shortcut" << name << "have non-existent path" << filePath;
|
||||
it = shortcut.erase(it);
|
||||
continue;
|
||||
}
|
||||
++it;
|
||||
}
|
||||
inst->setShortcuts(shortcut);
|
||||
if (!shortcut.isEmpty())
|
||||
qDebug() << "Loaded" << shortcut.size() << "shortcut(s) for instance" << inst->name();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue