Merge "net: fix NPE when reading IP configurations"
This commit is contained in:
@@ -322,8 +322,11 @@ public class IpConfigStore {
|
|||||||
gateway = InetAddresses.parseNumericAddress(in.readUTF());
|
gateway = InetAddresses.parseNumericAddress(in.readUTF());
|
||||||
}
|
}
|
||||||
// If the destination is a default IPv4 route, use the gateway
|
// If the destination is a default IPv4 route, use the gateway
|
||||||
// address unless already set.
|
// address unless already set. If there is no destination, assume
|
||||||
if (dest.getAddress() instanceof Inet4Address
|
// 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) {
|
&& dest.getPrefixLength() == 0 && gatewayAddress == null) {
|
||||||
gatewayAddress = gateway;
|
gatewayAddress = gateway;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user