Check both pointers in GetContainingTypeLib.

This commit is contained in:
Mike Hearn 2003-02-26 04:36:03 +00:00 committed by Alexandre Julliard
parent 7aa04f2744
commit ea957415b0
1 changed files with 13 additions and 6 deletions

View File

@ -4796,12 +4796,19 @@ static HRESULT WINAPI ITypeInfo_fnGetContainingTypeLib( ITypeInfo2 *iface,
ITypeLib * *ppTLib, UINT *pIndex) ITypeLib * *ppTLib, UINT *pIndex)
{ {
ICOM_THIS( ITypeInfoImpl, iface); ICOM_THIS( ITypeInfoImpl, iface);
if (!pIndex)
return E_INVALIDARG; /* If a pointer is null, we simply ignore it, the ATL in particular passes pIndex as 0 */
*ppTLib=(LPTYPELIB )(This->pTypeLib); if (pIndex) {
*pIndex=This->index; *pIndex=This->index;
TRACE("returning pIndex=%d", *pIndex);
}
if (ppTLib) {
*ppTLib=(LPTYPELIB )(This->pTypeLib);
ITypeLib2_AddRef(*ppTLib); ITypeLib2_AddRef(*ppTLib);
TRACE("(%p) returns (%p) index %d!\n", This, *ppTLib, *pIndex); TRACE("returning ppTLib=%p", *ppTLib);
}
return S_OK; return S_OK;
} }