diff --git a/src/core/file_sys/card_image.cpp b/src/core/file_sys/card_image.cpp index 8f5142a070..ecdd7505b6 100644 --- a/src/core/file_sys/card_image.cpp +++ b/src/core/file_sys/card_image.cpp @@ -122,14 +122,16 @@ u64 XCI::GetProgramTitleID() const { return secure_partition->GetProgramTitleID(); } -std::shared_ptr XCI::GetProgramNCA() const { - return program; +bool XCI::HasProgramNCA() const { + return program != nullptr; } VirtualFile XCI::GetProgramNCAFile() const { - if (GetProgramNCA() == nullptr) + if (!HasProgramNCA()) { return nullptr; - return GetProgramNCA()->GetBaseFile(); + } + + return program->GetBaseFile(); } const std::vector>& XCI::GetNCAs() const { diff --git a/src/core/file_sys/card_image.h b/src/core/file_sys/card_image.h index ce514dfa09..48cbef6668 100644 --- a/src/core/file_sys/card_image.h +++ b/src/core/file_sys/card_image.h @@ -80,7 +80,7 @@ public: u64 GetProgramTitleID() const; - std::shared_ptr GetProgramNCA() const; + bool HasProgramNCA() const; VirtualFile GetProgramNCAFile() const; const std::vector>& GetNCAs() const; std::shared_ptr GetNCAByType(NCAContentType type) const; diff --git a/src/core/loader/xci.cpp b/src/core/loader/xci.cpp index 7a619acb4e..461607c95a 100644 --- a/src/core/loader/xci.cpp +++ b/src/core/loader/xci.cpp @@ -59,8 +59,7 @@ ResultStatus AppLoader_XCI::Load(Kernel::Process& process) { if (xci->GetProgramNCAStatus() != ResultStatus::Success) return xci->GetProgramNCAStatus(); - const auto nca = xci->GetProgramNCA(); - if (nca == nullptr && !Core::Crypto::KeyManager::KeyFileExists(false)) + if (!xci->HasProgramNCA() && !Core::Crypto::KeyManager::KeyFileExists(false)) return ResultStatus::ErrorMissingProductionKeyFile; const auto result = nca_loader->Load(process);