impr: Don't try to apply patches if there are none
This commit is contained in:
parent
245c56ba8a
commit
6a9f79628e
@ -37,15 +37,14 @@ namespace hex::plugin::builtin {
|
||||
|
||||
|
||||
void FileProvider::read(u64 offset, void *buffer, size_t size, bool overlays) {
|
||||
if ((offset - this->getBaseAddress()) > (this->getActualSize() - size) || buffer == nullptr || size == 0)
|
||||
return;
|
||||
|
||||
this->readRaw(offset - this->getBaseAddress(), buffer, size);
|
||||
|
||||
if (overlays) {
|
||||
if (auto &patches = this->getPatches(); !patches.empty()) {
|
||||
for (u64 i = 0; i < size; i++)
|
||||
if (getPatches().contains(offset + i))
|
||||
reinterpret_cast<u8 *>(buffer)[i] = getPatches()[offset + i];
|
||||
if (patches.contains(offset + i))
|
||||
reinterpret_cast<u8 *>(buffer)[i] = patches[offset + i];
|
||||
}
|
||||
|
||||
this->applyOverlays(offset, buffer, size);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user