mirror of
https://github.com/jakcron/nstool.git
synced 2024-12-23 03:05:27 +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
|
@ -627,6 +627,12 @@ NpdmProcess::NpdmProcess() :
|
||||||
void NpdmProcess::process()
|
void NpdmProcess::process()
|
||||||
{
|
{
|
||||||
fnd::MemoryBlob scratch;
|
fnd::MemoryBlob scratch;
|
||||||
|
|
||||||
|
if (mReader == nullptr)
|
||||||
|
{
|
||||||
|
throw fnd::Exception(kModuleName, "No file reader set.");
|
||||||
|
}
|
||||||
|
|
||||||
scratch.alloc(mReader->size());
|
scratch.alloc(mReader->size());
|
||||||
mReader->read(scratch.getBytes(), 0, scratch.getSize());
|
mReader->read(scratch.getBytes(), 0, scratch.getSize());
|
||||||
|
|
||||||
|
|
|
@ -110,6 +110,11 @@ void PfsProcess::process()
|
||||||
{
|
{
|
||||||
fnd::MemoryBlob scratch;
|
fnd::MemoryBlob scratch;
|
||||||
|
|
||||||
|
if (mReader == nullptr)
|
||||||
|
{
|
||||||
|
throw fnd::Exception(kModuleName, "No file reader set.");
|
||||||
|
}
|
||||||
|
|
||||||
// open minimum header to get full header size
|
// open minimum header to get full header size
|
||||||
scratch.alloc(sizeof(nx::sPfsHeader));
|
scratch.alloc(sizeof(nx::sPfsHeader));
|
||||||
mReader->read(scratch.getBytes(), mOffset, scratch.getSize());
|
mReader->read(scratch.getBytes(), mOffset, scratch.getSize());
|
||||||
|
|
|
@ -193,6 +193,11 @@ void XciProcess::process()
|
||||||
{
|
{
|
||||||
fnd::MemoryBlob scratch;
|
fnd::MemoryBlob scratch;
|
||||||
|
|
||||||
|
if (mReader == nullptr)
|
||||||
|
{
|
||||||
|
throw fnd::Exception(kModuleName, "No file reader set.");
|
||||||
|
}
|
||||||
|
|
||||||
// read header page
|
// read header page
|
||||||
mReader->read((byte_t*)&mHdrPage, mOffset, sizeof(nx::sXciHeaderPage));
|
mReader->read((byte_t*)&mHdrPage, mOffset, sizeof(nx::sXciHeaderPage));
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue