Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1f5e3a1a authored by Wink Saville's avatar Wink Saville Committed by Android Git Automerger
Browse files

am 9c7c8794: am 76a118dd: Merge "Fix initialization of RouteInfo" into honeycomb-LTE

* commit '9c7c8794':
  Fix initialization of RouteInfo
parents b856f43e 9c7c8794
Loading
Loading
Loading
Loading
+15 −3
Original line number Diff line number Diff line
@@ -47,13 +47,25 @@ public class RouteInfo implements Parcelable {
    public RouteInfo(LinkAddress destination, InetAddress gateway) {
        if (destination == null) {
            try {
                if ((gateway != null) || (gateway instanceof Inet4Address)) {
                if (gateway != null) {
                    if (gateway instanceof Inet4Address) {
                        destination = new LinkAddress(Inet4Address.ANY, 0);
                    } else {
                        destination = new LinkAddress(Inet6Address.ANY, 0);
                    }
                } else {
                    // no destination, no gateway. invalid.
                    throw new RuntimeException("Invalid arguments passed in.");
                }
            } catch (Exception e) {}
        }
        if (gateway == null) {
            if (destination.getAddress() instanceof Inet4Address) {
                gateway = Inet4Address.ANY;
            } else {
                gateway = Inet6Address.ANY;
            }
        }
        mDestination = new LinkAddress(NetworkUtils.getNetworkPart(destination.getAddress(),
                destination.getNetworkPrefixLength()), destination.getNetworkPrefixLength());
        mGateway = gateway;