Index: mash/shell/shell_application_delegate.cc |
diff --git a/mash/shell/shell_application_delegate.cc b/mash/shell/shell_application_delegate.cc |
index 68c01fd6807ab5092cfd18a893e91dae2e32e801..4c2196e6e99068d286b42c9d180f07508e56aa1f 100644 |
--- a/mash/shell/shell_application_delegate.cc |
+++ b/mash/shell/shell_application_delegate.cc |
@@ -117,8 +117,12 @@ void ShellApplicationDelegate::StartRestartableService( |
// TODO(beng): This would be the place to insert logic that counted restarts |
// to avoid infinite crash-restart loops. |
scoped_ptr<mojo::Connection> connection = shell_->Connect(url); |
- connection->SetRemoteServiceProviderConnectionErrorHandler(restart_callback); |
- connections_[url] = std::move(connection); |
+ // Note: |connection| may be null if we've lost our connection to the shell. |
+ if (connection) { |
+ connection->SetRemoteServiceProviderConnectionErrorHandler( |
+ restart_callback); |
+ connections_[url] = std::move(connection); |
+ } |
} |
} // namespace shell |