From 724a9d342bb8d9371cc8b50d976933457d9b097e Mon Sep 17 00:00:00 2001 From: altalk23 <45172705+altalk23@users.noreply.github.com> Date: Sun, 26 Feb 2023 17:11:02 +0300 Subject: [PATCH] Modify don't hook if address is nullptr --- loader/include/Geode/modify/Modify.hpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/loader/include/Geode/modify/Modify.hpp b/loader/include/Geode/modify/Modify.hpp index e2ed7c85..925b6757 100644 --- a/loader/include/Geode/modify/Modify.hpp +++ b/loader/include/Geode/modify/Modify.hpp @@ -13,6 +13,12 @@ if constexpr (Unique::different< \ Resolve<__VA_ARGS__>::func(&Base::FunctionName_), \ Resolve<__VA_ARGS__>::func(&Derived::FunctionName_)>()) { \ + if (address() == 0) { \ + log::error( \ + "Address of {} returned nullptr, can't hook", #ClassName_ "::" #FunctionName_ \ + ); \ + break; \ + } \ auto hook = Hook::create( \ Mod::get(), \ reinterpret_cast(address()), \ @@ -106,7 +112,11 @@ namespace geode::modifier { class ModifyDerive { public: ModifyDerive() { - static_assert(alwaysFalse, "Modified class not recognized, please include to be able to use it."); + static_assert( + alwaysFalse, + "Modified class not recognized, please include to be " + "able to use it." + ); } }; }