diff --git a/dom/plugins/PluginMessageUtils.h b/dom/plugins/PluginMessageUtils.h index a47a9583019..dcb188f021a 100644 --- a/dom/plugins/PluginMessageUtils.h +++ b/dom/plugins/PluginMessageUtils.h @@ -210,8 +210,10 @@ NPNVariableToString(NPNVariable aVar) inline bool IsPluginThread() { - MessageLoop::Type type = MessageLoop::current()->type(); - return type == MessageLoop::TYPE_UI; + MessageLoop* loop = MessageLoop::current(); + if (!loop) + return false; + return (loop->type() == MessageLoop::TYPE_UI); } inline void AssertPluginThread() diff --git a/ipc/chromium/src/base/message_loop.h b/ipc/chromium/src/base/message_loop.h index 725879f2b70..68d6524d5f6 100644 --- a/ipc/chromium/src/base/message_loop.h +++ b/ipc/chromium/src/base/message_loop.h @@ -437,6 +437,8 @@ class MessageLoopForUI : public MessageLoop { // Returns the MessageLoopForUI of the current thread. static MessageLoopForUI* current() { MessageLoop* loop = MessageLoop::current(); + if (!loop) + return NULL; #ifdef CHROMIUM_MOZILLA_BUILD Type type = loop->type(); DCHECK(type == MessageLoop::TYPE_UI ||