shill: Fix crash when service is disabled after receiving IP config.

BUG=chromium-os:34127
TEST=Unit tests, network_3GSmokeTest

Change-Id: Ie3cfdcfec4906b089248a357826473e1ec237941
Reviewed-on: https://gerrit.chromium.org/gerrit/32973
Reviewed-by: Paul Stewart <pstew@chromium.org>
Commit-Ready: Thieu Le <thieule@chromium.org>
Tested-by: Thieu Le <thieule@chromium.org>
diff --git a/device.cc b/device.cc
index 910abf9..8237c9c 100644
--- a/device.cc
+++ b/device.cc
@@ -451,7 +451,9 @@
     // Subtle: Start portal detection after transitioning the service
     // to the Connected state because this call may immediately transition
     // to the Online state.
-    StartPortalDetection();
+    if (selected_service_) {
+      StartPortalDetection();
+    }
     StartLinkMonitor();
   } else {
     // TODO(pstew): This logic gets yet more complex when multiple