Merge "net: fix NPE when reading IP configurations" am: ca9a233b8d

Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1879657

Change-Id: I9ad5d7bdb2c9aa08bcfeca78c0a4858101f28444
This commit is contained in:
Chalard Jean
2021-11-26 07:23:37 +00:00
committed by Automerger Merge Worker

View File

@@ -322,8 +322,11 @@ public class IpConfigStore {
gateway = InetAddresses.parseNumericAddress(in.readUTF());
}
// If the destination is a default IPv4 route, use the gateway
// address unless already set.
if (dest.getAddress() instanceof Inet4Address
// address unless already set. If there is no destination, assume
// it is default route and use the gateway address in all cases.
if (dest == null) {
gatewayAddress = gateway;
} else if (dest.getAddress() instanceof Inet4Address
&& dest.getPrefixLength() == 0 && gatewayAddress == null) {
gatewayAddress = gateway;
} else {