fix: error "undefined reading 0" on android
Massimo Melina committed
Oct 10, 2024 at 14:27 UTC
646852317b1409897d70e3fae5231f9c4a667a18
1 file changed
+1
-1
src/nat.ts
+1
-1
@@ -70,7 +70,7 @@ export const getNatInfo = debounceAsync(async () => {
70
const gatewayIp = res && try_(() => new URL(res.gateway.description).hostname, () => console.debug('unexpected upnp gw', res.gateway?.description))
71
|| await findGateway().catch(() => undefined)
72
const localIps = await getIps(false)
73
- const localIp = res?.address || gatewayIp ? _.maxBy(localIps, x => inCommon(x, gatewayIp!)) : localIps[0]
73
+ const localIp = res?.address || (gatewayIp ? _.maxBy(localIps, x => inCommon(x, gatewayIp)) : localIps[0])
74
const internalPort = status?.https?.listening && status.https.port || status?.http?.listening && status.http.port || undefined
75
const mapped = _.find(mappings, x => x.private.host === localIp && x.private.port === internalPort)
76
const externalPort = mapped?.public.port