Skip to content

Commit

Permalink
Fix crash on windows 7
Browse files Browse the repository at this point in the history
  • Loading branch information
Garey Akhmetshin committed Apr 15, 2022
1 parent 9276ecf commit 0ac7b99
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -930,11 +930,14 @@ void* dlsym_hook(void* __restrict __handle,
{
subhook_remove(dlsymHook);
auto ret = dlsym(__handle, __name);
if (!strcmp(__name, "Server_GetBlendingInterface"))
if (__name && !strcmp(__name, "Server_GetBlendingInterface"))
{
ret = (void*)Server_GetBlendingInterface;
}
subhook_install(dlsymHook);
else
{
subhook_install(dlsymHook);
}

return ret;
}
Expand All @@ -947,11 +950,14 @@ FARPROC WINAPI GetProcAddressHooked(
{
subhook_remove(GetProcAddressHook);
auto ret = GetProcAddress(hModule, lpProcName);
if (!strcmp(lpProcName, "Server_GetBlendingInterface"))
if (lpProcName && !strcmp(lpProcName, "Server_GetBlendingInterface"))
{
ret = (FARPROC)Server_GetBlendingInterface;
}
subhook_install(GetProcAddressHook);
else
{
subhook_install(GetProcAddressHook);
}

return ret;
}
Expand Down

0 comments on commit 0ac7b99

Please sign in to comment.