From f02b44f440865f0b5bb7fe0385ad670d957f71e7 Mon Sep 17 00:00:00 2001 From: notaz Date: Mon, 26 Mar 2018 08:38:37 +0300 Subject: [PATCH] [dxgi] Fix some argument checks (#205) Changed according to wine's tests. --- src/dxgi/dxgi_adapter.cpp | 3 +++ src/dxgi/dxgi_factory.cpp | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/dxgi/dxgi_adapter.cpp b/src/dxgi/dxgi_adapter.cpp index 9ee5a95df..42ffe6397 100644 --- a/src/dxgi/dxgi_adapter.cpp +++ b/src/dxgi/dxgi_adapter.cpp @@ -71,6 +71,9 @@ namespace dxvk { HRESULT STDMETHODCALLTYPE DxgiAdapter::GetDesc(DXGI_ADAPTER_DESC* pDesc) { + if (pDesc == nullptr) + return E_INVALIDARG; + DXGI_ADAPTER_DESC1 desc1; HRESULT hr = this->GetDesc1(&desc1); diff --git a/src/dxgi/dxgi_factory.cpp b/src/dxgi/dxgi_factory.cpp index 443eab997..adac98de1 100644 --- a/src/dxgi/dxgi_factory.cpp +++ b/src/dxgi/dxgi_factory.cpp @@ -50,8 +50,8 @@ namespace dxvk { IUnknown* pDevice, DXGI_SWAP_CHAIN_DESC* pDesc, IDXGISwapChain** ppSwapChain) { - if (ppSwapChain == nullptr || pDesc == nullptr) - return E_INVALIDARG; + if (ppSwapChain == nullptr || pDesc == nullptr || pDevice == NULL) + return DXGI_ERROR_INVALID_CALL; try { *ppSwapChain = ref(new DxgiSwapChain(this, pDevice, pDesc));