Handle incomplete MAC address (#15)

This commit is contained in:
Fedor Korotkov 2022-03-29 12:07:03 -04:00 committed by GitHub
parent 49d430b3c4
commit 9f8d3017d9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 0 deletions

View File

@ -81,6 +81,9 @@ struct ARPCache {
}
let rawMAC = try match.getCaptureGroup(name: "mac", for: line)
if rawMAC == "(incomplete)" {
continue
}
guard let mac = MACAddress(fromString: rawMAC) else {
throw ARPCommandYieldedInvalidOutputError(explanation: "failed to parse MAC address \(rawMAC)")
}