gameux: Always return NULL when category not available (valgrind) (try 2)

André Hentschel nerv at dawncrow.de
Wed Jan 26 10:45:12 CST 2011


see wine-devel and try 1
---
 dlls/gameux/gamestatistics.c |   13 +++++++------
 1 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/dlls/gameux/gamestatistics.c b/dlls/gameux/gamestatistics.c
index c96fb6d..42a7583 100644
--- a/dlls/gameux/gamestatistics.c
+++ b/dlls/gameux/gamestatistics.c
@@ -814,19 +814,20 @@ static HRESULT WINAPI GameStatisticsImpl_GetCategoryTitle(
     WORD categoryIndex,
     LPWSTR *pTitle)
 {
-    HRESULT hr = S_OK;
     LONG nLength;
     GameStatisticsImpl *This = impl_from_IGameStatistics(iface);
 
     TRACE("%p, %d, %p\n", This, categoryIndex, pTitle);
 
-    *pTitle = NULL;
+    if(!pTitle)
+        return E_INVALIDARG;
 
-    if(!pTitle || categoryIndex >= MAX_CATEGORIES)
-        hr = E_INVALIDARG;
+    *pTitle = NULL;
 
+    if (categoryIndex >= MAX_CATEGORIES)
+        return E_INVALIDARG;
 
-    if(SUCCEEDED(hr))
+    if(This->stats.categories[categoryIndex].sName)
     {
         nLength = lstrlenW(This->stats.categories[categoryIndex].sName);
         if(nLength != 0)
@@ -836,7 +837,7 @@ static HRESULT WINAPI GameStatisticsImpl_GetCategoryTitle(
         }
     }
 
-    return hr;
+    return S_OK;
 }
 
 static HRESULT WINAPI GameStatisticsImpl_GetStatistic(
-- 

Best Regards, André Hentschel



More information about the wine-patches mailing list