From cf463a9b6734f19ca88c3b9d279b8fb8e8d9ab01 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Tue, 2 Oct 2018 23:10:24 -0400 Subject: card_image: Ensure program_nca_status is always initialized If any of the error paths before the NCA retrieval are taken, it'll result in program_nca_status being left in an inconsistent state. So we initialize it by default with a value indicating an error. --- src/core/file_sys/card_image.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/core/file_sys') diff --git a/src/core/file_sys/card_image.cpp b/src/core/file_sys/card_image.cpp index edfc1bbd4..8f5142a07 100644 --- a/src/core/file_sys/card_image.cpp +++ b/src/core/file_sys/card_image.cpp @@ -20,7 +20,9 @@ namespace FileSys { constexpr std::array partition_names = {"update", "normal", "secure", "logo"}; -XCI::XCI(VirtualFile file_) : file(std::move(file_)), partitions(0x4) { +XCI::XCI(VirtualFile file_) + : file(std::move(file_)), program_nca_status{Loader::ResultStatus::ErrorXCIMissingProgramNCA}, + partitions(0x4) { if (file->ReadObject(&header) != sizeof(GamecardHeader)) { status = Loader::ResultStatus::ErrorBadXCIHeader; return; -- cgit v1.2.3