summaryrefslogtreecommitdiffstats
path: root/src/core
diff options
context:
space:
mode:
authorZach Hilman <zachhilman@gmail.com>2019-04-10 18:28:32 +0200
committerZach Hilman <zachhilman@gmail.com>2019-09-21 22:43:10 +0200
commit06db4d94fde745c39326fe5564b93348610a5674 (patch)
treea336102dfda065f9463a621fa22478dfecb452b0 /src/core
parentregistered_cache: Process *.cnmt.nca files (diff)
downloadyuzu-06db4d94fde745c39326fe5564b93348610a5674.tar
yuzu-06db4d94fde745c39326fe5564b93348610a5674.tar.gz
yuzu-06db4d94fde745c39326fe5564b93348610a5674.tar.bz2
yuzu-06db4d94fde745c39326fe5564b93348610a5674.tar.lz
yuzu-06db4d94fde745c39326fe5564b93348610a5674.tar.xz
yuzu-06db4d94fde745c39326fe5564b93348610a5674.tar.zst
yuzu-06db4d94fde745c39326fe5564b93348610a5674.zip
Diffstat (limited to 'src/core')
-rw-r--r--src/core/file_sys/patch_manager.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/core/file_sys/patch_manager.cpp b/src/core/file_sys/patch_manager.cpp
index a8f80e2c6..0a4f0ea74 100644
--- a/src/core/file_sys/patch_manager.cpp
+++ b/src/core/file_sys/patch_manager.cpp
@@ -187,6 +187,11 @@ std::vector<u8> PatchManager::PatchNSO(const std::vector<u8>& nso, const std::st
LOG_INFO(Loader, "Patching NSO for name={}, build_id={}", name, build_id);
const auto load_dir = Service::FileSystem::GetModificationLoadRoot(title_id);
+ if (load_dir == nullptr) {
+ LOG_ERROR(Loader, "Cannot load mods for invalid title_id={:016X}", title_id);
+ return nso;
+ }
+
auto patch_dirs = load_dir->GetSubdirectories();
std::sort(patch_dirs.begin(), patch_dirs.end(),
[](const VirtualDir& l, const VirtualDir& r) { return l->GetName() < r->GetName(); });
@@ -225,6 +230,11 @@ bool PatchManager::HasNSOPatch(const std::array<u8, 32>& build_id_) const {
LOG_INFO(Loader, "Querying NSO patch existence for build_id={}", build_id);
const auto load_dir = Service::FileSystem::GetModificationLoadRoot(title_id);
+ if (load_dir == nullptr) {
+ LOG_ERROR(Loader, "Cannot load mods for invalid title_id={:016X}", title_id);
+ return false;
+ }
+
auto patch_dirs = load_dir->GetSubdirectories();
std::sort(patch_dirs.begin(), patch_dirs.end(),
[](const VirtualDir& l, const VirtualDir& r) { return l->GetName() < r->GetName(); });
@@ -259,6 +269,11 @@ static std::optional<CheatList> ReadCheatFileFromFolder(const Core::System& syst
std::vector<CheatList> PatchManager::CreateCheatList(const Core::System& system,
const std::array<u8, 32>& build_id_) const {
const auto load_dir = Service::FileSystem::GetModificationLoadRoot(title_id);
+ if (load_dir == nullptr) {
+ LOG_ERROR(Loader, "Cannot load mods for invalid title_id={:016X}", title_id);
+ return {};
+ }
+
auto patch_dirs = load_dir->GetSubdirectories();
std::sort(patch_dirs.begin(), patch_dirs.end(),
[](const VirtualDir& l, const VirtualDir& r) { return l->GetName() < r->GetName(); });