shill: Ensure valid cellular service before using it.
Cellular::OnConnectFailed() and CellularCapabilityGSM::OnConnectReply()
may be called when there are no cellular service. This CL checks to
make sure the service is valid before using it.
BUG=chromium-os:31016
TEST=Unit tests, network_3GModemControl
Change-Id: I79ffeccf80f79c5cbe62ce93c6feaabf86ae5ea1
Reviewed-on: https://gerrit.chromium.org/gerrit/23042
Commit-Ready: Thieu Le <thieule@chromium.org>
Reviewed-by: Thieu Le <thieule@chromium.org>
Tested-by: Thieu Le <thieule@chromium.org>
diff --git a/cellular.cc b/cellular.cc
index 1f8bfb9..e3cdcb2 100644
--- a/cellular.cc
+++ b/cellular.cc
@@ -432,7 +432,8 @@
}
void Cellular::OnConnectFailed(const Error &error) {
- service_->SetFailure(Service::kFailureUnknown);
+ if (service_)
+ service_->SetFailure(Service::kFailureUnknown);
}
void Cellular::Disconnect(Error *error) {