Index: ipc/ipc_mojo_bootstrap.cc |
diff --git a/ipc/ipc_mojo_bootstrap.cc b/ipc/ipc_mojo_bootstrap.cc |
index 2c554620e9d67b25c437202929b494397cfd2167..89a74343f811b89c5f4bc243814912aaab8c29fb 100644 |
--- a/ipc/ipc_mojo_bootstrap.cc |
+++ b/ipc/ipc_mojo_bootstrap.cc |
@@ -788,6 +788,12 @@ class ChannelAssociatedGroupController |
if (!endpoint) |
return; |
+ // Careful, if the endpoint is detached its members are cleared. Check for |
+ // that before dereferencing. |
+ mojo::InterfaceEndpointClient* client = endpoint->client(); |
+ if (!client) |
+ return; |
+ |
DCHECK(endpoint->task_runner()->BelongsToCurrentThread()); |
MessageWrapper message_wrapper = endpoint->PopSyncMessage(message_id); |
@@ -796,10 +802,6 @@ class ChannelAssociatedGroupController |
if (message_wrapper.value().IsNull()) |
return; |
- mojo::InterfaceEndpointClient* client = endpoint->client(); |
- if (!client) |
- return; |
- |
bool result = false; |
{ |
base::AutoUnlock unlocker(lock_); |