impr: Throw error if no data could be read with read node

This commit is contained in:
WerWolv
2025-08-30 10:31:51 +02:00
parent c70b505b3a
commit 9135153dc9

View File

@@ -25,10 +25,14 @@ namespace hex::plugin::builtin {
const auto &address = u64(this->getIntegerOnInput(0));
const auto &size = u64(this->getIntegerOnInput(1));
const auto provider = ImHexApi::Provider::get();
if (address + size > provider->getActualSize())
throwNodeError("Read exceeds file size");
std::vector<u8> data;
data.resize(size);
ImHexApi::Provider::get()->readRaw(address, data.data(), size);
provider->readRaw(address, data.data(), size);
this->setBufferOnOutput(2, data);
}