Skip to content

Commit 7be8e0e

Browse files
committed
interfaces: Haiku's getifaddrs() returns interfaces with NULL ifa_addr fields.
So check for this explicitly, so as not to crash. :) Reference Issue #166.
1 parent 75eb5d1 commit 7be8e0e

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/SDL_net.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -713,7 +713,7 @@ static void RefreshInterfaces(void) // LINUX/BSD VERSION
713713
NetworkInterface *new_interfaces = NULL;
714714
int new_num_interfaces = 0;
715715
for (struct ifaddrs *i = ifaddr; i != NULL; i = i->ifa_next) {
716-
if (i->ifa_name != NULL) {
716+
if (i->ifa_name && i->ifa_addr) {
717717
new_num_interfaces++;
718718
}
719719
}
@@ -729,7 +729,7 @@ static void RefreshInterfaces(void) // LINUX/BSD VERSION
729729

730730
NetworkInterface *iface = &new_interfaces[0];
731731
for (struct ifaddrs *i = ifaddr; i != NULL; i = i->ifa_next, iface++) {
732-
if (i->ifa_name == NULL) {
732+
if (!i->ifa_name || !i->ifa_addr) {
733733
continue; // i guess.
734734
}
735735

0 commit comments

Comments
 (0)