Merge pull request 'fix: Wrap DNS check in catch to avoid runtime crash' (#322) from dns-check-fix into master

Reviewed-on: https://git.selfprivacy.org/SelfPrivacy/selfprivacy.org.app/pulls/322
Reviewed-by: Inex Code <inex.code@selfprivacy.org>
This commit is contained in:
NaiJi ✨ 2023-09-05 14:43:02 +03:00
commit 63ac367007

View file

@ -218,19 +218,23 @@ class ServerInstallationRepository {
final Map<String, bool> skippedMatches,
) async {
final Map<String, bool> matches = <String, bool>{};
await InternetAddress.lookup(domainName!).then(
(final records) {
for (final record in records) {
if (skippedMatches[record.host] ?? false) {
matches[record.host] = true;
continue;
try {
await InternetAddress.lookup(domainName!).then(
(final records) {
for (final record in records) {
if (skippedMatches[record.host] ?? false) {
matches[record.host] = true;
continue;
}
if (record.address == ip4!) {
matches[record.host] = true;
}
}
if (record.address == ip4!) {
matches[record.host] = true;
}
}
},
);
},
);
} catch (e) {
print(e);
}
return matches;
}