dns: dnsmasq: avoid crash when no reverse domains exist

ip_data->domains.reverse can be NULL when the device is being removed
and has no IP configuration for a short moment.

Fixes: 6409e7719c

https://bugzilla.gnome.org/show_bug.cgi?id=797022
This commit is contained in:
Beniamino Galvani 2018-09-13 14:50:32 +02:00
parent 4a1ff8ad8c
commit f0c075f050

View file

@ -183,10 +183,12 @@ add_ip_config (NMDnsDnsmasq *self, GVariantBuilder *servers, const NMDnsIPConfig
domain[0] ? domain : NULL);
}
for (j = 0; ip_data->domains.reverse[j]; j++) {
add_dnsmasq_nameserver (self, servers,
ip_addr_to_string_buf,
ip_data->domains.reverse[j]);
if (ip_data->domains.reverse) {
for (j = 0; ip_data->domains.reverse[j]; j++) {
add_dnsmasq_nameserver (self, servers,
ip_addr_to_string_buf,
ip_data->domains.reverse[j]);
}
}
}
}