mirror of
https://github.com/Thealexbarney/LibHac.git
synced 2024-11-14 10:49:41 +01:00
Add null check when creating Bktr
This commit is contained in:
parent
1dc232e704
commit
d701fdd28b
3 changed files with 2 additions and 6 deletions
|
@ -425,7 +425,6 @@ namespace hactoolnet
|
||||||
using (var file = new FileStream(ctx.Options.InFile, FileMode.Open, FileAccess.Read))
|
using (var file = new FileStream(ctx.Options.InFile, FileMode.Open, FileAccess.Read))
|
||||||
{
|
{
|
||||||
var save = new Savefile(file, ctx.Logger);
|
var save = new Savefile(file, ctx.Logger);
|
||||||
var layout = save.Header.Layout;
|
|
||||||
|
|
||||||
if (ctx.Options.OutDir != null)
|
if (ctx.Options.OutDir != null)
|
||||||
{
|
{
|
||||||
|
|
|
@ -20,9 +20,9 @@ namespace libhac
|
||||||
public Bktr(Stream patchRomfs, Stream baseRomfs, NcaSection section)
|
public Bktr(Stream patchRomfs, Stream baseRomfs, NcaSection section)
|
||||||
{
|
{
|
||||||
if (section.Type != SectionType.Bktr) throw new ArgumentException("Section is not of type BKTR");
|
if (section.Type != SectionType.Bktr) throw new ArgumentException("Section is not of type BKTR");
|
||||||
|
Patch = patchRomfs ?? throw new NullReferenceException($"{nameof(patchRomfs)} cannot be null");
|
||||||
|
Base = baseRomfs ?? throw new NullReferenceException($"{nameof(baseRomfs)} cannot be null");
|
||||||
|
|
||||||
Patch = patchRomfs;
|
|
||||||
Base = baseRomfs;
|
|
||||||
IvfcLevelHeader level5 = section.Header.Bktr.IvfcHeader.LevelHeaders[5];
|
IvfcLevelHeader level5 = section.Header.Bktr.IvfcHeader.LevelHeaders[5];
|
||||||
Length = level5.LogicalOffset + level5.HashDataSize;
|
Length = level5.LogicalOffset + level5.HashDataSize;
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,5 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
namespace libhac
|
namespace libhac
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue