[PATCH] d3dx9_36: Moved param NULL a bit forward (Coverity)

Marcus Meissner marcus at jet.franken.de
Sat Jun 11 04:00:33 CDT 2011


Hi,

param was now used before checking it for NULL.
Move the NULL check a bit earlier.
CID 5118

Ciao, Marcus
---
 dlls/d3dx9_36/effect.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/dlls/d3dx9_36/effect.c b/dlls/d3dx9_36/effect.c
index bbe21f0..ca88f76 100644
--- a/dlls/d3dx9_36/effect.c
+++ b/dlls/d3dx9_36/effect.c
@@ -1516,6 +1516,11 @@ static HRESULT WINAPI ID3DXBaseEffectImpl_GetValue(ID3DXBaseEffect *iface, D3DXH
     TRACE("iface %p, parameter %p, data %p, bytes %u\n", This, parameter, data, bytes);
 
     if (!param) param = get_parameter_by_name(This, NULL, parameter);
+    if (!param)
+    {
+        WARN("Invalid parameter %p specified\n", parameter);
+        return D3DERR_INVALIDCALL;
+    }
 
     /* samplers don't touch data */
     if (param->class == D3DXPC_OBJECT && (param->type == D3DXPT_SAMPLER
@@ -1526,7 +1531,7 @@ static HRESULT WINAPI ID3DXBaseEffectImpl_GetValue(ID3DXBaseEffect *iface, D3DXH
         return E_FAIL;
     }
 
-    if (data && param && param->bytes <= bytes)
+    if (data && param->bytes <= bytes)
     {
         TRACE("Type %s\n", debug_d3dxparameter_type(param->type));
 
-- 
1.7.3.4




More information about the wine-patches mailing list