Skip to content

Commit

Permalink
Check variable before using it
Browse files Browse the repository at this point in the history
  • Loading branch information
elishacloud committed Jun 27, 2024
1 parent 831a4b2 commit c43b54b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion BuildNo.rc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
#define BUILD_NUMBER 75
#define BUILD_NUMBER 76
8 changes: 7 additions & 1 deletion IDirectInputDeviceX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -694,6 +694,12 @@ HRESULT m_IDirectInputDeviceX::CreateEffect(REFGUID rguid, LPCDIEFFECT lpeff, LP
{
Logging::LogDebug() << __FUNCTION__ << " (" << this << ") Trying! " << rguid << " " << punkOuter;

if (!ppdeff)
{
return DIERR_INVALIDPARAM;
}
*ppdeff = nullptr;

DIEFFECT eff = {};
if (lpeff && lpeff->dwSize == sizeof(DIEFFECT_DX5))
{
Expand All @@ -704,7 +710,7 @@ HRESULT m_IDirectInputDeviceX::CreateEffect(REFGUID rguid, LPCDIEFFECT lpeff, LP

HRESULT hr = ProxyInterface->CreateEffect(rguid, lpeff, ppdeff, punkOuter);

if (SUCCEEDED(hr) && ppdeff)
if (SUCCEEDED(hr))
{
m_IDirectInputEffect* pEffect = new m_IDirectInputEffect((IDirectInputEffect*)*ppdeff);
pEffect->SetVersion(diVersion);
Expand Down

0 comments on commit c43b54b

Please sign in to comment.