Properly handle opening patch NCAs with an empty base section

This commit is contained in:
Alex Barney 2019-05-14 17:03:53 -05:00
parent d189826203
commit 353c538c6b

View file

@ -181,7 +181,7 @@ namespace LibHac.Fs.NcaUtils
public IStorage OpenRawStorageWithPatch(Nca patchNca, int index) public IStorage OpenRawStorageWithPatch(Nca patchNca, int index)
{ {
IStorage patchStorage = patchNca.OpenRawStorage(index); IStorage patchStorage = patchNca.OpenRawStorage(index);
IStorage baseStorage = OpenRawStorage(index); IStorage baseStorage = SectionExists(index) ? OpenRawStorage(index) : new NullStorage();
NcaFsHeader header = patchNca.Header.GetFsHeader(index); NcaFsHeader header = patchNca.Header.GetFsHeader(index);
NcaFsPatchInfo patchInfo = header.GetPatchInfo(); NcaFsPatchInfo patchInfo = header.GetPatchInfo();