mirror of
https://github.com/jakcron/nstool
synced 2024-11-15 02:06:40 +00:00
[nstool] Add checks to ensure a reader object is provided to the Process classes.
This commit is contained in:
parent
167a343937
commit
3411118e26
3 changed files with 16 additions and 0 deletions
|
@ -627,6 +627,12 @@ NpdmProcess::NpdmProcess() :
|
|||
void NpdmProcess::process()
|
||||
{
|
||||
fnd::MemoryBlob scratch;
|
||||
|
||||
if (mReader == nullptr)
|
||||
{
|
||||
throw fnd::Exception(kModuleName, "No file reader set.");
|
||||
}
|
||||
|
||||
scratch.alloc(mReader->size());
|
||||
mReader->read(scratch.getBytes(), 0, scratch.getSize());
|
||||
|
||||
|
|
|
@ -110,6 +110,11 @@ void PfsProcess::process()
|
|||
{
|
||||
fnd::MemoryBlob scratch;
|
||||
|
||||
if (mReader == nullptr)
|
||||
{
|
||||
throw fnd::Exception(kModuleName, "No file reader set.");
|
||||
}
|
||||
|
||||
// open minimum header to get full header size
|
||||
scratch.alloc(sizeof(nx::sPfsHeader));
|
||||
mReader->read(scratch.getBytes(), mOffset, scratch.getSize());
|
||||
|
|
|
@ -193,6 +193,11 @@ void XciProcess::process()
|
|||
{
|
||||
fnd::MemoryBlob scratch;
|
||||
|
||||
if (mReader == nullptr)
|
||||
{
|
||||
throw fnd::Exception(kModuleName, "No file reader set.");
|
||||
}
|
||||
|
||||
// read header page
|
||||
mReader->read((byte_t*)&mHdrPage, mOffset, sizeof(nx::sXciHeaderPage));
|
||||
|
||||
|
|
Loading…
Reference in a new issue