fix: Exception when opening a null provider
This commit is contained in:
parent
5ff752c9af
commit
4b1884944d
@ -173,10 +173,22 @@ namespace hex::plugin::builtin::recent {
|
||||
});
|
||||
|
||||
std::unordered_set<RecentEntry, RecentEntry::HashFunction> uniqueProviders;
|
||||
for (u32 i = 0; i < recentFilePaths.size() && uniqueProviders.size() < MaxRecentEntries; i++) {
|
||||
auto &path = recentFilePaths[i];
|
||||
for (const auto &path : recentFilePaths) {
|
||||
if (uniqueProviders.size() >= MaxRecentEntries)
|
||||
break;
|
||||
|
||||
try {
|
||||
auto jsonData = nlohmann::json::parse(wolv::io::File(path, wolv::io::File::Mode::Read).readString());
|
||||
wolv::io::File recentFile(path, wolv::io::File::Mode::Read);
|
||||
if (!recentFile.isValid()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
auto content = recentFile.readString();
|
||||
if (content.empty()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
auto jsonData = nlohmann::json::parse(content);
|
||||
uniqueProviders.insert(RecentEntry {
|
||||
.displayName = jsonData.at("displayName"),
|
||||
.type = jsonData.at("type"),
|
||||
|
Loading…
x
Reference in New Issue
Block a user