bug: if we have only one network interface, then terminate the linked list with nullptr

otherwise, the windows build will crash
This commit is contained in:
despair86 2018-10-01 02:27:43 -05:00
parent 2fdc7ae8a8
commit 19b7f47322

View File

@ -263,6 +263,10 @@ _llarp_nt_getadaptersinfo(struct llarp_nt_ifaddrs_t** ifap)
ift->_ifa.ifa_next = (struct llarp_nt_ifaddrs_t*)(ift + 1);
ift = (struct _llarp_nt_ifaddrs_t*)(ift->_ifa.ifa_next);
}
else
{
ift->_ifa.ifa_next = nullptr;
}
}
}
@ -868,7 +872,7 @@ namespace llarp
if(i->ifa_addr->sa_family == af)
{
llarp::Addr a(*i->ifa_addr);
if(!(a.isPrivate() || a.isLoopback()))
if(!(a.isPrivate() || a.isLoopback() || (a.getHostLong() == 0)))
{
ifname = i->ifa_name;
found = true;