Bug 787158 - nshttpconnection::mtransaction null pointer. r=honzab, a=lsblakk
authorPatrick McManus <mcmanus@ducksong.com>
Tue, 12 Mar 2013 16:00:58 -0400
changeset 132369 bffd02161e606fbdfbe61b3a57596a923a264910
parent 132368 94f1fa2b14739e942b1270f87a05f76422a2bc46
child 132370 7327827c9c8452157a892e773d70a145911e6980
push id2323
push userbbajaj@mozilla.com
push dateMon, 01 Apr 2013 19:47:02 +0000
treeherdermozilla-beta@7712be144d91 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewershonzab, lsblakk
bugs787158
milestone21.0a2
Bug 787158 - nshttpconnection::mtransaction null pointer. r=honzab, a=lsblakk
netwerk/protocol/http/nsHttpConnection.cpp
--- a/netwerk/protocol/http/nsHttpConnection.cpp
+++ b/netwerk/protocol/http/nsHttpConnection.cpp
@@ -1269,27 +1269,31 @@ nsHttpConnection::OnSocketWritable()
         else if (NS_FAILED(mSocketOutCondition)) {
             if (mSocketOutCondition == NS_BASE_STREAM_WOULD_BLOCK)
                 rv = mSocketOut->AsyncWait(this, 0, 0, nullptr); // continue writing
             else
                 rv = mSocketOutCondition;
             again = false;
         }
         else if (n == 0) {
-            // 
-            // at this point we've written out the entire transaction, and now we
-            // must wait for the server's response.  we manufacture a status message
-            // here to reflect the fact that we are waiting.  this message will be
-            // trumped (overwritten) if the server responds quickly.
-            //
-            mTransaction->OnTransportStatus(mSocketTransport,
-                                            NS_NET_STATUS_WAITING_FOR,
-                                            0);
+            rv = NS_OK;
 
-            rv = ResumeRecv(); // start reading
+            if (mTransaction) { // in case the ReadSegments stack called CloseTransaction()
+                // 
+                // at this point we've written out the entire transaction, and now we
+                // must wait for the server's response.  we manufacture a status message
+                // here to reflect the fact that we are waiting.  this message will be
+                // trumped (overwritten) if the server responds quickly.
+                //
+                mTransaction->OnTransportStatus(mSocketTransport,
+                                                NS_NET_STATUS_WAITING_FOR,
+                                                0);
+
+                rv = ResumeRecv(); // start reading
+            }
             again = false;
         }
         // write more to the socket until error or end-of-request...
     } while (again);
 
     return rv;
 }