1
0
Fork 0
forked from suyu/suyu

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.
This commit is contained in:
Lioncash 2018-10-02 23:10:24 -04:00
parent bc679c9b8c
commit cf463a9b67

View file

@ -20,7 +20,9 @@ namespace FileSys {
constexpr std::array<const char*, 0x4> partition_names = {"update", "normal", "secure", "logo"}; constexpr std::array<const char*, 0x4> 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)) { if (file->ReadObject(&header) != sizeof(GamecardHeader)) {
status = Loader::ResultStatus::ErrorBadXCIHeader; status = Loader::ResultStatus::ErrorBadXCIHeader;
return; return;