DO NOT MERGE: Fix null dereference in carrier networks
WifiStateMachine can respond to CMD_HAS_CARRIER_CONFIGURED_NETWORKS
with a null object if it is not in a state to handle this. Therefore
syncHasCarrierConfiguredNetworks must check for null before
attempting to cast the result object back to boolean.
Bug: 34050164
Test: Compile
Change-Id: I21b80ef3989ca2d6a09784f9c9a44f4af19b5850
diff --git a/service/java/com/android/server/wifi/WifiStateMachine.java b/service/java/com/android/server/wifi/WifiStateMachine.java
index 9cc26b1..d5e9d02 100644
--- a/service/java/com/android/server/wifi/WifiStateMachine.java
+++ b/service/java/com/android/server/wifi/WifiStateMachine.java
@@ -2031,7 +2031,7 @@
int uuid, AsyncChannel channel) {
Message resultMsg = channel.sendMessageSynchronously(
CMD_HAS_CARRIER_CONFIGURED_NETWORKS, uuid);
- boolean result = (boolean) resultMsg.obj;
+ boolean result = resultMsg.obj != null && (boolean) resultMsg.obj;
resultMsg.recycle();
return result;
}