diff --git a/src/target/DarwinTarget.cpp b/src/target/DarwinTarget.cpp index bf94381..7934fd9 100644 --- a/src/target/DarwinTarget.cpp +++ b/src/target/DarwinTarget.cpp @@ -87,13 +87,13 @@ geode::Result<> DarwinTarget::writeMemory(void* destination, void const* source, // (this causes a crash in the result destructor, which is not very good) auto r1 = this->protectMemory(destination, size, this->getWritableProtection()); - auto r2 = r1.isOk() ? this->rawWriteMemory(destination, source, size) : r1; - auto r3 = r1.isOk() ? this->protectMemory(destination, size, oldProtection) : r1; + auto r2 = r1.and_(this->rawWriteMemory(destination, source, size)); + auto r3 = r2.and_(this->protectMemory(destination, size, oldProtection)); // permissions restored, it's safe to do result stuff now - if (r1.isErr() || r2.isErr() || r3.isErr()) { + if (r3.isErr()) { // return the first error - return geode::Err(r1.errorOr(r2.errorOr(r3.unwrapErr()))); + return geode::Err(r3.unwrapErr()); } return geode::Ok(); } diff --git a/test/misc/Mod.cpp b/test/misc/Mod.cpp index 2c6f131..f4dd1cb 100644 --- a/test/misc/Mod.cpp +++ b/test/misc/Mod.cpp @@ -156,7 +156,7 @@ void makeHookAndWrapper(void* target, T* func, U** orig) { std::cout << "unable to create handler: " << handleResult.unwrapErr() << "\n"; exit(1); } - auto handle = *handleResult; + auto handle = handleResult.unwrap(); auto h_metadata = HookMetadata { .m_priority = 2