Null-Check Optional NACP before extracting application title

Not doing this can lead to the NACP being filled with invalid data and led to crashes on homebrew titles like SpaceNX.
This commit is contained in:
PixelyIon 2021-10-16 13:01:35 +01:00
parent c8821c7313
commit 1d532628cb

View File

@ -64,7 +64,7 @@ namespace skyline::loader {
}
state.process->memory.InitializeVmm(memory::AddressSpaceType::AddressSpace39Bit);
auto applicationName{nacp->GetApplicationName(nacp->GetFirstSupportedTitleLanguage())};
auto applicationName{nacp ? nacp->GetApplicationName(nacp->GetFirstSupportedTitleLanguage()) : ""};
auto loadInfo{LoadExecutable(process, state, executable, 0, applicationName.empty() ? "main.nro" : applicationName + ".nro")};
state.process->memory.InitializeRegions(loadInfo.base, loadInfo.size);