diff --git a/src/resolve/resolved-etc-hosts.c b/src/resolve/resolved-etc-hosts.c index 334778706a..cf0e2be5fa 100644 --- a/src/resolve/resolved-etc-hosts.c +++ b/src/resolve/resolved-etc-hosts.c @@ -486,7 +486,7 @@ static int etc_hosts_lookup_by_name( break; } - SET_FOREACH(a, item->addresses) { + SET_FOREACH(a, item ? item->addresses : NULL) { _cleanup_(dns_resource_record_unrefp) DnsResourceRecord *rr = NULL; if ((!found_a && a->family == AF_INET) ||