| Index: ash/system/chromeos/network/vpn_list_view.cc
|
| diff --git a/ash/system/chromeos/network/vpn_list_view.cc b/ash/system/chromeos/network/vpn_list_view.cc
|
| index d3f30613c085ba7b6079b9e7bc15a2eec37edabd..a80853bc2cec4196b3521dc92a3dd954d57c3943 100644
|
| --- a/ash/system/chromeos/network/vpn_list_view.cc
|
| +++ b/ash/system/chromeos/network/vpn_list_view.cc
|
| @@ -239,10 +239,14 @@ VPNListView::VPNListView(ui::NetworkListDelegate* delegate)
|
| }
|
|
|
| VPNListView::~VPNListView() {
|
| - Shell::GetInstance()
|
| - ->system_tray_delegate()
|
| - ->GetVPNDelegate()
|
| - ->RemoveObserver(this);
|
| + // We need the check as on shell destruction, the delegate is destroyed first.
|
| + SystemTrayDelegate* const system_tray_delegate =
|
| + Shell::GetInstance()->system_tray_delegate();
|
| + if (system_tray_delegate) {
|
| + VPNDelegate* const vpn_delegate = system_tray_delegate->GetVPNDelegate();
|
| + if (vpn_delegate)
|
| + vpn_delegate->RemoveObserver(this);
|
| + }
|
| }
|
|
|
| void VPNListView::Update() {
|
|
|