CallGetService-nullcheck
author Benjamin Smedberg <benjamin@smedbergs.us>
Sat, 26 Jul 2008 22:49:39 -0400
changeset 167 a4da40849f5436e629c5732f4368c6c48189637f
parent 69 d09f8c6883b5fea4797d39d21345ead6b7f96ed3
permissions -rw-r--r--
State as of now

diff --git a/xpcom/glue/nsComponentManagerUtils.cpp b/xpcom/glue/nsComponentManagerUtils.cpp
--- a/xpcom/glue/nsComponentManagerUtils.cpp
+++ b/xpcom/glue/nsComponentManagerUtils.cpp
@@ -77,9 +77,12 @@ nsresult
 nsresult
 CallGetService(const nsCID &aCID, const nsIID &aIID, void **aResult)
 {
-    nsComponentManagerImpl *compMgr =
-        nsComponentManagerImpl::gComponentManager->instance;
-    NS_ENSURE_TRUE(compMgr, NS_ERROR_NOT_INITIALIZED);
+    NS_ENSURE_TRUE(nsComponentManagerImpl::gComponentManager &&
+                   nsComponentManagerImpl::gComponentManager->instance,
+                   NS_ERROR_NOT_INITIALIZED);
+
+    nsComponentManagerImpl *compMgr =
+        nsComponentManagerImpl::gComponentManager->instance;
 
     return compMgr->nsComponentManagerImpl::GetService(aCID, aIID, aResult);
 }
@@ -87,9 +90,12 @@ nsresult
 nsresult
 CallGetService(const char *aContractID, const nsIID &aIID, void **aResult)
 {
-    nsComponentManagerImpl *compMgr =
-        nsComponentManagerImpl::gComponentManager->instance;
-    NS_ENSURE_TRUE(compMgr, NS_ERROR_NOT_INITIALIZED);
+    NS_ENSURE_TRUE(nsComponentManagerImpl::gComponentManager &&
+                   nsComponentManagerImpl::gComponentManager->instance,
+                   NS_ERROR_NOT_INITIALIZED);
+
+    nsComponentManagerImpl *compMgr =
+        nsComponentManagerImpl::gComponentManager->instance;
 
     return compMgr->
         nsComponentManagerImpl::GetServiceByContractID(aContractID,