summaryrefslogtreecommitdiff
path: root/src/resolve/resolved-dns-cache.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/resolve/resolved-dns-cache.c')
-rw-r--r--src/resolve/resolved-dns-cache.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/resolve/resolved-dns-cache.c b/src/resolve/resolved-dns-cache.c
index 28a375baed..7359dfa271 100644
--- a/src/resolve/resolved-dns-cache.c
+++ b/src/resolve/resolved-dns-cache.c
@@ -352,12 +352,16 @@ int dns_cache_put(DnsCache *c, DnsQuestion *q, int rcode, DnsAnswer *answer, uns
int r;
assert(c);
- assert(answer);
+ assert(q);
/* First, delete all matching old RRs, so that we only keep
* complete by_key in place. */
for (i = 0; i < q->n_keys; i++)
dns_cache_remove(c, q->keys[i]);
+
+ if (!answer)
+ return 0;
+
for (i = 0; i < answer->n_rrs; i++)
dns_cache_remove(c, answer->rrs[i]->key);