diff --git a/xpcom/build/nsXPComInit.cpp b/xpcom/build/nsXPComInit.cpp index 7962ceec02f..6692e14036b 100644 --- a/xpcom/build/nsXPComInit.cpp +++ b/xpcom/build/nsXPComInit.cpp @@ -436,10 +436,11 @@ nsresult NS_COM NS_ShutdownXPCOM(nsIServiceManager* servMgr) { nsrefcnt cnt; - // We may have AddRef'd for the caller of NS_InitXPCOM, so release it - // here again: + // We may have AddRef'd for the caller of NS_InitXPCOM, so release it + // here again: + NS_IF_RELEASE(servMgr); - NS_RELEASE2(nsServiceManager::mGlobalServiceManager, cnt); + NS_RELEASE2(nsServiceManager::mGlobalServiceManager, cnt); NS_ASSERTION(cnt == 0, "Service Manager being held past XPCOM shutdown."); // Finally, release the component manager last because it unloads the @@ -453,4 +454,4 @@ nsresult NS_COM NS_ShutdownXPCOM(nsIServiceManager* servMgr) return NS_OK; } -//////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////