Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Commit

Permalink
Implement client.getDomain() null check
Browse files Browse the repository at this point in the history
  • Loading branch information
EdGeraghty authored May 20, 2024
1 parent 9c383c4 commit 43373fd
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/SlidingSyncManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -359,10 +359,14 @@ export class SlidingSyncManager {
let proxyUrl: string | undefined;

try {
const clientWellKnown = await AutoDiscovery.findClientConfig(client.getDomain());
const clientDomain = await client.getDomain();
if (clientDomain === null) {
throw new RangeError("Homeserver domain is null");
}
const clientWellKnown = await AutoDiscovery.findClientConfig(clientDomain);
proxyUrl = clientWellKnown?.["org.matrix.msc3575.proxy"]?.url;
} catch (e) {
// client.getDomain() is invalid, `AutoDiscovery.findClientConfig` has thrown
// client.getDomain() is null, we've thrown
}

if (proxyUrl != undefined) {
Expand Down

0 comments on commit 43373fd

Please sign in to comment.