Index: chrome/browser/chromeos/policy/device_cloud_policy_store_chromeos.cc |
diff --git a/chrome/browser/chromeos/policy/device_cloud_policy_store_chromeos.cc b/chrome/browser/chromeos/policy/device_cloud_policy_store_chromeos.cc |
index f069335c56010ed551f99f96963be27c1692e347..5471086376976044fc9b5d4db12cf9e287323644 100644 |
--- a/chrome/browser/chromeos/policy/device_cloud_policy_store_chromeos.cc |
+++ b/chrome/browser/chromeos/policy/device_cloud_policy_store_chromeos.cc |
@@ -40,7 +40,8 @@ DeviceCloudPolicyStoreChromeOS::DeviceCloudPolicyStoreChromeOS( |
} |
DeviceCloudPolicyStoreChromeOS::~DeviceCloudPolicyStoreChromeOS() { |
- device_settings_service_->RemoveObserver(this); |
+ if (device_settings_service_) |
+ device_settings_service_->RemoveObserver(this); |
} |
void DeviceCloudPolicyStoreChromeOS::Store( |
@@ -107,6 +108,7 @@ void DeviceCloudPolicyStoreChromeOS::DeviceSettingsUpdated() { |
} |
void DeviceCloudPolicyStoreChromeOS::OnDeviceSettingsServiceShutdown() { |
+ device_settings_service_->RemoveObserver(this); |
device_settings_service_ = nullptr; |
} |