зеркало из https://github.com/mozilla/pjs.git
Fix bug 315246: nsGetInterface::operator() can use an uninitialized nsresult variable, if the source fails to implement nsIInterfaceRequestor (which fires an assertion in debug builds). r=dougt, sr=bzbarsky.
This commit is contained in:
Родитель
d8196b6b42
Коммит
2254bafe1b
|
@ -42,23 +42,25 @@
|
|||
nsresult
|
||||
nsGetInterface::operator()( const nsIID& aIID, void** aInstancePtr ) const
|
||||
{
|
||||
nsresult status;
|
||||
nsresult status;
|
||||
|
||||
if ( mSource )
|
||||
{
|
||||
nsCOMPtr<nsIInterfaceRequestor> factoryPtr = do_QueryInterface(mSource, &status);
|
||||
NS_ASSERTION(factoryPtr, "Did you know you were calling |do_GetInterface()| on an object that doesn't support the |nsIInterfaceRequestor| interface?");
|
||||
if ( mSource )
|
||||
{
|
||||
nsCOMPtr<nsIInterfaceRequestor> factoryPtr = do_QueryInterface(mSource, &status);
|
||||
NS_ASSERTION(factoryPtr, "Did you know you were calling |do_GetInterface()| on an object that doesn't support the |nsIInterfaceRequestor| interface?");
|
||||
|
||||
if ( factoryPtr )
|
||||
status = factoryPtr->GetInterface(aIID, aInstancePtr);
|
||||
if ( factoryPtr )
|
||||
status = factoryPtr->GetInterface(aIID, aInstancePtr);
|
||||
else
|
||||
status = NS_ERROR_NO_INTERFACE;
|
||||
|
||||
if ( NS_FAILED(status) )
|
||||
*aInstancePtr = 0;
|
||||
}
|
||||
else
|
||||
status = NS_ERROR_NULL_POINTER;
|
||||
if ( NS_FAILED(status) )
|
||||
*aInstancePtr = 0;
|
||||
}
|
||||
else
|
||||
status = NS_ERROR_NULL_POINTER;
|
||||
|
||||
if ( mErrorPtr )
|
||||
*mErrorPtr = status;
|
||||
return status;
|
||||
if ( mErrorPtr )
|
||||
*mErrorPtr = status;
|
||||
return status;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче