Check nullptr in _nvapi_disable_threaded_optimization to prevent crash

update outdated link

(cherry picked from commit a3f44cd67e)
This commit is contained in:
jsjtxietian 2023-11-20 19:31:14 +08:00 committed by Yuri Sizov
parent d3713220b8
commit 126874bb38

View File

@ -100,8 +100,8 @@ static bool nvapi_err_check(const char *msg, int status) {
}
// On windows we have to disable threaded optimization when using NVIDIA graphics cards
// to avoid stuttering, see https://github.com/microsoft/vscode-cpptools/issues/6592
// also see https://github.com/Ryujinx/Ryujinx/blob/master/Ryujinx.Common/GraphicsDriver/NVThreadedOptimization.cs
// to avoid stuttering, see https://stackoverflow.com/questions/36959508/nvidia-graphics-driver-causing-noticeable-frame-stuttering/37632948
// also see https://github.com/Ryujinx/Ryujinx/blob/master/src/Ryujinx.Common/GraphicsDriver/NVThreadedOptimization.cs
void GLManager_Windows::_nvapi_disable_threaded_optimization() {
HMODULE nvapi = 0;
#ifdef _WIN64
@ -145,6 +145,10 @@ void GLManager_Windows::_nvapi_disable_threaded_optimization() {
NvDRSSessionHandle session_handle;
if (NvAPI_DRS_CreateSession == nullptr) {
return;
}
if (!nvapi_err_check("NVAPI: Error creating DRS session", NvAPI_DRS_CreateSession(&session_handle))) {
NvAPI_Unload();
return;