From ea957415b0343168a3d4ad917edb309d0fa60c1e Mon Sep 17 00:00:00 2001 From: Mike Hearn Date: Wed, 26 Feb 2003 04:36:03 +0000 Subject: [PATCH] Check both pointers in GetContainingTypeLib. --- dlls/oleaut32/typelib.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/dlls/oleaut32/typelib.c b/dlls/oleaut32/typelib.c index 0d30b16b13b..54f1839db5e 100644 --- a/dlls/oleaut32/typelib.c +++ b/dlls/oleaut32/typelib.c @@ -4796,12 +4796,19 @@ static HRESULT WINAPI ITypeInfo_fnGetContainingTypeLib( ITypeInfo2 *iface, ITypeLib * *ppTLib, UINT *pIndex) { ICOM_THIS( ITypeInfoImpl, iface); - if (!pIndex) - return E_INVALIDARG; - *ppTLib=(LPTYPELIB )(This->pTypeLib); - *pIndex=This->index; - ITypeLib2_AddRef(*ppTLib); - TRACE("(%p) returns (%p) index %d!\n", This, *ppTLib, *pIndex); + + /* If a pointer is null, we simply ignore it, the ATL in particular passes pIndex as 0 */ + if (pIndex) { + *pIndex=This->index; + TRACE("returning pIndex=%d", *pIndex); + } + + if (ppTLib) { + *ppTLib=(LPTYPELIB )(This->pTypeLib); + ITypeLib2_AddRef(*ppTLib); + TRACE("returning ppTLib=%p", *ppTLib); + } + return S_OK; }