[PATCH] combase: reorder checks (Coverity)

Marcus Meissner marcus at jet.franken.de
Sun Jan 11 16:37:03 CST 2015


CID 1262242

reorder the checks to the order they were likely meant to be in
---
 dlls/combase/string.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/dlls/combase/string.c b/dlls/combase/string.c
index 9ec05c6..7054af6 100644
--- a/dlls/combase/string.c
+++ b/dlls/combase/string.c
@@ -99,13 +99,13 @@ HRESULT WINAPI WindowsCreateStringReference(LPCWSTR ptr, UINT32 len,
         return E_INVALIDARG;
     if (ptr == NULL && len > 0)
         return E_POINTER;
-    if (ptr[len] != '\0')
-        return E_INVALIDARG;
     if (len == 0)
     {
         *out = NULL;
         return S_OK;
     }
+    if (ptr[len] != '\0')
+        return E_INVALIDARG;
     priv->buffer = (LPWSTR)ptr;
     priv->length = len;
     priv->reference = TRUE;
-- 
1.8.4.5




More information about the wine-patches mailing list