Index: chrome/browser/devtools/devtools_ui_bindings.cc |
diff --git a/chrome/browser/devtools/devtools_ui_bindings.cc b/chrome/browser/devtools/devtools_ui_bindings.cc |
index 4588f4ab5e4b3e575113742fb970c401c398bf85..903deb53c6a8227b2e6c6e1e391bdffda325f1f1 100644 |
--- a/chrome/browser/devtools/devtools_ui_bindings.cc |
+++ b/chrome/browser/devtools/devtools_ui_bindings.cc |
@@ -794,7 +794,8 @@ void DevToolsUIBindings::SetDelegate(Delegate* delegate) { |
} |
void DevToolsUIBindings::AttachTo(content::DevToolsAgentHost* agent_host) { |
- DCHECK(!agent_host_); |
+ if (agent_host_) |
+ Detach(); |
agent_host_ = agent_host; |
agent_host_->AttachClient(this); |
} |
@@ -806,8 +807,8 @@ void DevToolsUIBindings::Reattach() { |
} |
void DevToolsUIBindings::Detach() { |
- DCHECK(agent_host_); |
- agent_host_->DetachClient(); |
+ if (agent_host_) |
+ agent_host_->DetachClient(); |
agent_host_ = NULL; |
} |