Skip to content

Commit 2140d1d

Browse files
Irfan Sheriffandroid code review
authored andcommitted
Merge "Avoid system_server crashing due to mac address is null"
2 parents 6ffe259 + 21326d8 commit 2140d1d

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

core/java/android/net/arp/ArpPeer.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,11 @@ public ArpPeer(String interfaceName, InetAddress myAddr, String mac,
5353
mInterfaceName = interfaceName;
5454
mMyAddr = myAddr;
5555

56-
for (int i = 0; i < MAC_ADDR_LENGTH; i++) {
57-
mMyMac[i] = (byte) Integer.parseInt(mac.substring(
58-
i*3, (i*3) + 2), 16);
56+
if (mac != null) {
57+
for (int i = 0; i < MAC_ADDR_LENGTH; i++) {
58+
mMyMac[i] = (byte) Integer.parseInt(mac.substring(
59+
i*3, (i*3) + 2), 16);
60+
}
5961
}
6062

6163
if (myAddr instanceof Inet6Address || peer instanceof Inet6Address) {

0 commit comments

Comments
 (0)