summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
Diffstat (limited to 'src/core')
-rw-r--r--src/core/network.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/core/network.c b/src/core/network.c
index 17f91d90..8792b9e8 100644
--- a/src/core/network.c
+++ b/src/core/network.c
@@ -407,12 +407,14 @@ int net_gethostbyname(const char *addr, IPADDR *ip4, IPADDR *ip6)
while (ai != NULL && count < 2) {
so = (union sockaddr_union *) ai->ai_addr;
- if (ai->ai_family == AF_INET6 && ip6->family == 0) {
- sin_get_ip(so, ip6);
- count++;
- } else if (ai->ai_family == AF_INET && ip4->family == 0) {
- sin_get_ip(so, ip4);
- count++;
+ if (so != NULL) {
+ if (ai->ai_family == AF_INET6 && ip6->family == 0) {
+ sin_get_ip(so, ip6);
+ count++;
+ } else if (ai->ai_family == AF_INET && ip4->family == 0) {
+ sin_get_ip(so, ip4);
+ count++;
+ }
}
ai = ai->ai_next;
}