From 1ee520e6fa81cdd93faa56b5e2ac33d43d8f3a13 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 9c8809cb..8033eb1d 100644 --- a/OptiScaler/hooks/Vulkan_Hooks.cpp +++ b/OptiScaler/hooks/Vulkan_Hooks.cpp @@ -60,8 +60,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)