If the interface at start-up isn't valid don't NPE on missing IpReachabilityMonitor

Bug: 21165241
Change-Id: I2348d6e07daf2a910078b2413d70e711d34a1630
diff --git a/service/java/com/android/server/wifi/WifiStateMachine.java b/service/java/com/android/server/wifi/WifiStateMachine.java
index 1b6b46a..21c162f 100644
--- a/service/java/com/android/server/wifi/WifiStateMachine.java
+++ b/service/java/com/android/server/wifi/WifiStateMachine.java
@@ -4100,10 +4100,12 @@
                         + " old: " + mLinkProperties + " new: " + newLp);
             }
             mLinkProperties = newLp;
-            if (mLinkProperties != null) {
-                mIpReachabilityMonitor.updateLinkProperties(mLinkProperties);
-            } else {
-                mIpReachabilityMonitor.clearLinkProperties();
+            if (mIpReachabilityMonitor != null) {
+                if (mLinkProperties != null) {
+                    mIpReachabilityMonitor.updateLinkProperties(mLinkProperties);
+                } else {
+                    mIpReachabilityMonitor.clearLinkProperties();
+                }
             }
             if (mNetworkAgent != null) mNetworkAgent.sendLinkProperties(mLinkProperties);
         }
@@ -4221,7 +4223,9 @@
             }
         }
         mNetlinkTracker.clearLinkProperties();
-        mIpReachabilityMonitor.clearLinkProperties();
+        if (mIpReachabilityMonitor != null) {
+            mIpReachabilityMonitor.clearLinkProperties();
+        }
 
         // Now clear the merged link properties.
         mLinkProperties.clear();
@@ -4658,7 +4662,9 @@
     private void handleIpReachabilityLost() {
         // No need to be told about any additional neighbors that might also
         // become unreachable--quiet them now while we start disconnecting.
-        mIpReachabilityMonitor.clearLinkProperties();
+        if (mIpReachabilityMonitor != null) {
+            mIpReachabilityMonitor.clearLinkProperties();
+        }
 
         mWifiInfo.setInetAddress(null);
         mWifiInfo.setMeteredHint(false);