fix: Wrap DNS check in catch to avoid runtime crash

pull/322/head
NaiJi ✨ 2023-09-05 08:34:01 -03:00
parent 645d58d513
commit 8f7730575e
1 changed files with 16 additions and 12 deletions

View File

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