Fix reboot loop due to NPE
Bug: 2962059
Change-Id: I73d5fa5ef0f29dc139c843b34f58f189c94dfe4b
diff --git a/core/java/android/net/LinkProperties.java b/core/java/android/net/LinkProperties.java
index 9cb38e3..24aebfc 100644
--- a/core/java/android/net/LinkProperties.java
+++ b/core/java/android/net/LinkProperties.java
@@ -48,11 +48,13 @@
// copy constructor instead of clone
public LinkProperties(LinkProperties source) {
- mIface = source.getInterface();
- mAddresses = source.getAddresses();
- mDnses = source.getDnses();
- mGateway = source.getGateway();
- mHttpProxy = new ProxyProperties(source.getHttpProxy());
+ if (source != null) {
+ mIface = source.getInterface();
+ mAddresses = source.getAddresses();
+ mDnses = source.getDnses();
+ mGateway = source.getGateway();
+ mHttpProxy = new ProxyProperties(source.getHttpProxy());
+ }
}
public void setInterface(NetworkInterface iface) {
diff --git a/core/java/android/net/ProxyProperties.java b/core/java/android/net/ProxyProperties.java
index 24f6766..ba27221 100644
--- a/core/java/android/net/ProxyProperties.java
+++ b/core/java/android/net/ProxyProperties.java
@@ -38,9 +38,11 @@
// copy constructor instead of clone
public ProxyProperties(ProxyProperties source) {
- mProxy = source.getAddress();
- mPort = source.getPort();
- mExclusionList = new String(source.getExclusionList());
+ if (source != null) {
+ mProxy = source.getAddress();
+ mPort = source.getPort();
+ mExclusionList = new String(source.getExclusionList());
+ }
}
public InetAddress getAddress() {