mirror of
https://github.com/PenumbraOS/sdk.git
synced 2026-02-04 01:44:47 -06:00
Fixed DNS crash on resolution failure
This commit is contained in:
parent
4608265c3b
commit
3e4869deca
@ -28,7 +28,14 @@ export const setupNetworkHooks = (): void => {
|
||||
method.implementation = function (hostname: string) {
|
||||
if (dnsProvider) {
|
||||
const resolvedHostname = getDns(hostname);
|
||||
if (isIpAddress(resolvedHostname)) {
|
||||
if (resolvedHostname === null) {
|
||||
const UnknownHostException = Java.use(
|
||||
"java.net.UnknownHostException"
|
||||
);
|
||||
throw UnknownHostException.$new(
|
||||
`DNS resolution failed for ${hostname}`
|
||||
);
|
||||
} else if (isIpAddress(resolvedHostname)) {
|
||||
log(`Creating InetAddress directly for IP ${resolvedHostname}`);
|
||||
const parts = resolvedHostname.split(".");
|
||||
const bytes = Java.array(
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user