From e1b9f9b935ea0be8794f55e603625f506cff150a Mon Sep 17 00:00:00 2001 From: Alex Barney Date: Fri, 12 Oct 2018 18:07:46 -0500 Subject: [PATCH] Don't error if the a patch's base has no RomFS --- LibHac/Nca.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/LibHac/Nca.cs b/LibHac/Nca.cs index 8b50139a..db5c8505 100644 --- a/LibHac/Nca.cs +++ b/LibHac/Nca.cs @@ -140,8 +140,7 @@ namespace LibHac false); if (BaseNca == null) return rawStream; - Stream baseStream = BaseNca.OpenSection(ProgramPartitionType.Data, true, IntegrityCheckLevel.None); - if (baseStream == null) throw new InvalidDataException("Base NCA has no RomFS section"); + Stream baseStream = BaseNca.OpenSection(ProgramPartitionType.Data, true, IntegrityCheckLevel.None) ?? Stream.Null; return new Bktr(rawStream, baseStream, sect); @@ -162,11 +161,12 @@ namespace LibHac public Stream OpenSection(int index, bool raw, IntegrityCheckLevel integrityCheckLevel) { Stream rawStream = OpenRawSection(index); + + if (raw || rawStream == null) return rawStream; + NcaSection sect = Sections[index]; NcaFsHeader header = sect.Header; - if (raw || rawStream == null) return rawStream; - // If it's a patch section without a base, return the raw section because it has no hash data if (header.EncryptionType == NcaEncryptionType.AesCtrEx && BaseNca == null) return rawStream;