From 093e38a026dbfdc1dadb864e7ab4b82c02410ef6 Mon Sep 17 00:00:00 2001
From: "ananta@chromium.org"
 <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>
Date: Wed, 26 May 2010 04:43:05 +0000
Subject: In ChromeFrame there are cases when the
 ChromeFrameAutomationProxy::SendAsAsync function can be passed a NULL
 callback. The dispatcher needs to check for the same and ignore the returned
 callback message. We currently crash on trunk.

Review URL: http://codereview.chromium.org/2227001

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@48256 0039d316-1c4b-4281-b951-d872f2087c98
---
 chrome_frame/sync_msg_reply_dispatcher.cc | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

(limited to 'chrome_frame')

diff --git a/chrome_frame/sync_msg_reply_dispatcher.cc b/chrome_frame/sync_msg_reply_dispatcher.cc
index 1b51516..a59ba68 100644
--- a/chrome_frame/sync_msg_reply_dispatcher.cc
+++ b/chrome_frame/sync_msg_reply_dispatcher.cc
@@ -9,12 +9,14 @@
 void SyncMessageReplyDispatcher::Push(IPC::SyncMessage* msg,
                                       SyncMessageCallContext* context,
                                       void* key) {
-  context->message_type_ = msg->type();
-  context->id_ = IPC::SyncMessage::GetMessageId(*msg);
-  context->key_ = key;
+  if (context) {
+    context->message_type_ = msg->type();
+    context->id_ = IPC::SyncMessage::GetMessageId(*msg);
+    context->key_ = key;
 
-  AutoLock lock(message_queue_lock_);
-  message_queue_.push_back(context);
+    AutoLock lock(message_queue_lock_);
+    message_queue_.push_back(context);
+  }
 }
 
 bool SyncMessageReplyDispatcher::HandleMessageType(
-- 
cgit v1.1