aboutsummaryrefslogtreecommitdiff
path: root/lib/if2ip.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/if2ip.c')
-rw-r--r--lib/if2ip.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/if2ip.c b/lib/if2ip.c
index 9faa3b67a..c591a957a 100644
--- a/lib/if2ip.c
+++ b/lib/if2ip.c
@@ -78,7 +78,8 @@ char *Curl_if2ip(int af, const char *interface, char *buf, int buf_size)
if (getifaddrs(&head) >= 0) {
for (iface=head; iface != NULL; iface=iface->ifa_next) {
- if ((iface->ifa_addr->sa_family == af) &&
+ if ((iface->ifa_addr != NULL) &&
+ (iface->ifa_addr->sa_family == af) &&
curl_strequal(iface->ifa_name, interface)) {
void *addr;
char scope[12]="";