Fix NPE during dumpsys ethernet

Handle the case when IpClient wasn't created for network interface which
may happen for virtual device

Bug: 78482534
Test: dumpsys ethernet
Change-Id: I3405dd4f72d4a6444448f0d6ec0497aead07bade
This commit is contained in:
Pavel Maltsev
2018-04-28 23:23:26 -07:00
parent b23181bbe9
commit 97446b8978

View File

@@ -440,7 +440,12 @@ public class EthernetNetworkFactory extends NetworkFactory {
NetworkInterfaceState ifaceState = mTrackingInterfaces.get(iface);
pw.println(iface + ":" + ifaceState);
pw.increaseIndent();
ifaceState.mIpClient.dump(fd, pw, args);
final IpClient ipClient = ifaceState.mIpClient;
if (ipClient != null) {
ipClient.dump(fd, pw, args);
} else {
pw.println("IpClient is null");
}
pw.decreaseIndent();
}
pw.decreaseIndent();