Fix hanging UI when `null` addr

This commit is contained in:
i404788 2019-11-19 21:37:47 +00:00 committed by GitHub
parent 3f7bc1a6c1
commit 7340b1d6e3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 2 deletions

View File

@ -257,12 +257,11 @@ bool Init(bool open_adapter)
struct ifaddrs* curaddr = addrs; struct ifaddrs* curaddr = addrs;
while (curaddr) while (curaddr)
{ {
if (strcmp(curaddr->ifa_name, adata->DeviceName)) if (strcmp(curaddr->ifa_name, adata->DeviceName) || !curaddr->ifa_addr)
{ {
curaddr = curaddr->ifa_next; curaddr = curaddr->ifa_next;
continue; continue;
} }
if (!curaddr->ifa_addr) continue;
u16 af = curaddr->ifa_addr->sa_family; u16 af = curaddr->ifa_addr->sa_family;
if (af == AF_INET) if (af == AF_INET)