Fixes 132705. nsComponentManagerUtils error handling is incorrect. fix by dbaron, r=dougt, sr=rpotts, a=asa@mozilla.org

This commit is contained in:
dougt%netscape.com 2002-04-04 21:35:32 +00:00
Родитель b607ddcbb0
Коммит 940379bb25
1 изменённых файлов: 14 добавлений и 16 удалений

Просмотреть файл

@ -50,13 +50,12 @@ nsresult
nsCreateInstanceByCID::operator()( const nsIID& aIID, void** aInstancePtr ) const
{
nsCOMPtr<nsIComponentManager> compMgr;
NS_GetComponentManager(getter_AddRefs(compMgr));
if (!compMgr)
return NS_ERROR_FAILURE;
nsresult status = compMgr->CreateInstance(mCID,
mOuter,
aIID,
aInstancePtr);
nsresult status = NS_GetComponentManager(getter_AddRefs(compMgr));
if (compMgr)
status = compMgr->CreateInstance(mCID, mOuter, aIID, aInstancePtr);
else if (NS_SUCCEEDED(status))
status = NS_ERROR_UNEXPECTED;
if ( NS_FAILED(status) )
*aInstancePtr = 0;
@ -71,19 +70,18 @@ nsCreateInstanceByContractID::operator()( const nsIID& aIID, void** aInstancePtr
nsresult status;
if ( mContractID ) {
nsCOMPtr<nsIComponentManager> compMgr;
NS_GetComponentManager(getter_AddRefs(compMgr));
if (!compMgr)
return NS_ERROR_FAILURE;
status = compMgr->CreateInstanceByContractID(mContractID,
mOuter,
aIID,
aInstancePtr);
if (NS_FAILED(status))
*aInstancePtr = 0;
status = NS_GetComponentManager(getter_AddRefs(compMgr));
if (compMgr)
status = compMgr->CreateInstanceByContractID(mContractID, mOuter,
aIID, aInstancePtr);
else if (NS_SUCCEEDED(status))
status = NS_ERROR_UNEXPECTED;
}
else
status = NS_ERROR_NULL_POINTER;
if (NS_FAILED(status))
*aInstancePtr = 0;
if ( mErrorPtr )
*mErrorPtr = status;
return status;