Skip to content

Commit

Permalink
Fix NPE in switch after removing a link
Browse files Browse the repository at this point in the history
  • Loading branch information
Kilobyte22 committed Jun 23, 2021
1 parent 73f1d81 commit ce64580
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,10 @@ public void writeEthernetFrame(final NetworkInterface source, final byte[] frame
// if packet is to same port, drop
return;
}
adjacentInterfaces[host.iface].writeEthernetFrame(this, frame, timeToLive - TTL_COST);
NetworkInterface iface = adjacentInterfaces[host.iface];
if (iface != null) {
iface.writeEthernetFrame(this, frame, timeToLive - TTL_COST);
}
host.timestamp = tickTime;
} else {
super.writeEthernetFrame(source, frame, timeToLive);
Expand Down

0 comments on commit ce64580

Please sign in to comment.