ethernet: IpConfigStore#readIpConfigurations() can return null
If the version is invalid IpConfigStore#readIpConfigurations() will
return null, in which case ArrayMap#putAll() will throw an NPE.
Log and return instead.
Bug: 241588375
Test: TH
Change-Id: I1d7278f9571164a95ce21cb92e1219558cb1569f
diff --git a/service-t/src/com/android/server/ethernet/EthernetConfigStore.java b/service-t/src/com/android/server/ethernet/EthernetConfigStore.java
index 6006539..e4445d0 100644
--- a/service-t/src/com/android/server/ethernet/EthernetConfigStore.java
+++ b/service-t/src/com/android/server/ethernet/EthernetConfigStore.java
@@ -107,8 +107,13 @@
}
private void loadConfigFileLocked(final String filepath) {
+ // readIpConfigurations can return null when the version is invalid.
final ArrayMap<String, IpConfiguration> configs =
IpConfigStore.readIpConfigurations(filepath);
+ if (configs == null) {
+ Log.e(TAG, "IpConfigStore#readIpConfigurations() returned null");
+ return;
+ }
mIpConfigurations.putAll(configs);
}