This commit is contained in:
arm64v8a 2022-11-30 10:30:07 +09:00
parent 11e8f66d88
commit 3163b3e1aa
2 changed files with 6 additions and 1 deletions

View File

@ -17,11 +17,12 @@ namespace NekoRay {
} }
void ProfileManager::LoadManager() { void ProfileManager::LoadManager() {
QList<int> invaild_profile_id;
for (auto id: _profiles) { for (auto id: _profiles) {
auto ent = LoadProxyEntity(QString("profiles/%1.json").arg(id)); auto ent = LoadProxyEntity(QString("profiles/%1.json").arg(id));
if (ent == nullptr || ent->bean == nullptr || ent->bean->version == -114514) { if (ent == nullptr || ent->bean == nullptr || ent->bean->version == -114514) {
// clear invaild profile // clear invaild profile
DeleteProfile(id); invaild_profile_id << id;
continue; continue;
} }
profiles[id] = ent; profiles[id] = ent;
@ -29,6 +30,9 @@ namespace NekoRay {
for (auto id: _groups) { for (auto id: _groups) {
groups[id] = LoadGroup(QString("groups/%1.json").arg(id)); groups[id] = LoadGroup(QString("groups/%1.json").arg(id));
} }
for (auto id: invaild_profile_id) {
DeleteProfile(id);
}
} }
void ProfileManager::SaveManager() { void ProfileManager::SaveManager() {

View File

@ -4,6 +4,7 @@
#include <QFile> #include <QFile>
#include <QDir> #include <QDir>
#include <QFileInfo> #include <QFileInfo>
#include <QUrl>
#define WriteTempFile(fn, data) \ #define WriteTempFile(fn, data) \
QDir dir; \ QDir dir; \