From 5b4b4b9fefce0ad2d5f96946ef03fc26dba4e7e8 Mon Sep 17 00:00:00 2001 From: Hyper <34012267+hyperbx@users.noreply.github.com> Date: Mon, 25 Nov 2024 04:37:44 +0000 Subject: [PATCH] memory: make assertions lenient towards nullptr --- UnleashedRecomp/kernel/memory.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/UnleashedRecomp/kernel/memory.h b/UnleashedRecomp/kernel/memory.h index 8ff4504c..0a1eba22 100644 --- a/UnleashedRecomp/kernel/memory.h +++ b/UnleashedRecomp/kernel/memory.h @@ -16,13 +16,17 @@ public: void* Translate(size_t offset) const noexcept { - assert(offset < 0x100000000ull); + if (offset) + assert(offset < 0x100000000ull); + return base + offset; } uint32_t MapVirtual(void* host) const noexcept { - assert(host >= base && host < (base + size)); + if (host) + assert(host >= base && host < (base + size)); + return static_cast(static_cast(host) - base); } };