From 5ce9b6fb942e3f6969438dd5152c72aaa22f46c0 Mon Sep 17 00:00:00 2001 From: cdozdil Date: Fri, 31 Jul 2026 08:40:16 +0300 Subject: [PATCH] Added null checks before hooking --- OptiScaler/hooks/Vulkan_Hooks.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/OptiScaler/hooks/Vulkan_Hooks.cpp b/OptiScaler/hooks/Vulkan_Hooks.cpp index fefcc46c..f7fffc19 100644 --- a/OptiScaler/hooks/Vulkan_Hooks.cpp +++ b/OptiScaler/hooks/Vulkan_Hooks.cpp @@ -67,8 +67,11 @@ static void HookDevice(VkDevice InDevice) DetourTransactionBegin(); DetourUpdateThread(GetCurrentThread()); - DetourAttach(&(PVOID&) o_QueuePresentKHR, hkvkQueuePresentKHR); - DetourAttach(&(PVOID&) o_CreateSwapchainKHR, hkvkCreateSwapchainKHR); + if (o_QueuePresentKHR != nullptr) + DetourAttach(&(PVOID&) o_QueuePresentKHR, hkvkQueuePresentKHR); + + if (o_CreateSwapchainKHR != nullptr) + DetourAttach(&(PVOID&) o_CreateSwapchainKHR, hkvkCreateSwapchainKHR); auto detourResult = DetourTransactionCommit(); if (detourResult != NO_ERROR)