From 19b7f4732259a95d0c6be66f8920234b7fa52ada Mon Sep 17 00:00:00 2001 From: despair86 Date: Mon, 1 Oct 2018 02:27:43 -0500 Subject: [PATCH] bug: if we have only one network interface, then terminate the linked list with nullptr otherwise, the windows build will crash --- llarp/net.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/llarp/net.cpp b/llarp/net.cpp index 38b5e3305..c30215740 100644 --- a/llarp/net.cpp +++ b/llarp/net.cpp @@ -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;