| Index: content/renderer/battery_status/battery_status_dispatcher.cc
|
| diff --git a/content/renderer/battery_status/battery_status_dispatcher.cc b/content/renderer/battery_status/battery_status_dispatcher.cc
|
| index e7496113d7edd18bc6b9cb7199d605ba21da6af4..f6450694b8f24b0bd186fea11518a37b75f05321 100644
|
| --- a/content/renderer/battery_status/battery_status_dispatcher.cc
|
| +++ b/content/renderer/battery_status/battery_status_dispatcher.cc
|
| @@ -15,8 +15,11 @@ BatteryStatusDispatcher::BatteryStatusDispatcher(
|
| : listener_(listener) {
|
| DCHECK(listener_);
|
|
|
| - RenderThread::Get()->GetServiceRegistry()->ConnectToRemoteService(&monitor_);
|
| - monitor_.set_client(this);
|
| + if (ServiceRegistry* registry = RenderThread::Get()->GetServiceRegistry()) {
|
| + // registry can be null during testing.
|
| + registry->ConnectToRemoteService(&monitor_);
|
| + monitor_.set_client(this);
|
| + }
|
| }
|
|
|
| BatteryStatusDispatcher::~BatteryStatusDispatcher() {
|
|
|