Bug 827857 - make NS_ProxyRelease() handle null pointers properly; r=jlebar
authorMike Habicher <mikeh@mozilla.com>
Tue, 08 Jan 2013 13:34:49 -0500
changeset 127993 e1a3209ce6e310346108cae13b17a02b8b60a398
parent 127992 3a5db98b87e4dccda27f3fee83b4a022b99c81f2
child 127994 3fa426440a8e4a3ca2b3d6326c946627fa27e8a8
push idunknown
push userunknown
push dateunknown
reviewersjlebar
bugs827857
milestone21.0a1
Bug 827857 - make NS_ProxyRelease() handle null pointers properly; r=jlebar
xpcom/glue/nsProxyRelease.cpp
--- a/xpcom/glue/nsProxyRelease.cpp
+++ b/xpcom/glue/nsProxyRelease.cpp
@@ -25,16 +25,21 @@ private:
 };
 
 nsresult
 NS_ProxyRelease(nsIEventTarget *target, nsISupports *doomed,
                 bool alwaysProxy)
 {
     nsresult rv;
 
+    if (!doomed) {
+        // nothing to do
+        return NS_OK;
+    }
+
     if (!target) {
         NS_RELEASE(doomed);
         return NS_OK;
     }
 
     if (!alwaysProxy) {
         bool onCurrentThread = false;
         rv = target->IsOnCurrentThread(&onCurrentThread);