From 9755062563fb4697812ee5a55b99181615ecf3bf Mon Sep 17 00:00:00 2001 From: Bruno Windels <274386+bwindels@users.noreply.github.com> Date: Thu, 7 Apr 2022 10:33:12 +0200 Subject: [PATCH] fix error thrown during request when response code is not used --- src/matrix/net/RequestScheduler.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/matrix/net/RequestScheduler.ts b/src/matrix/net/RequestScheduler.ts index dc5c501b..c6e546a1 100644 --- a/src/matrix/net/RequestScheduler.ts +++ b/src/matrix/net/RequestScheduler.ts @@ -27,8 +27,8 @@ class Request implements IHomeServerRequest { public readonly args: any[]; private responseResolve: (result: any) => void; public responseReject: (error: Error) => void; - private responseCodeResolve: (result: any) => void; - private responseCodeReject: (result: any) => void; + private responseCodeResolve?: (result: any) => void; + private responseCodeReject?: (result: any) => void; private _requestResult?: IHomeServerRequest; private readonly _responsePromise: Promise; private _responseCodePromise: Promise; @@ -73,7 +73,7 @@ class Request implements IHomeServerRequest { const response = await this._requestResult?.response(); this.responseResolve(response); const responseCode = await this._requestResult?.responseCode(); - this.responseCodeResolve(responseCode); + this.responseCodeResolve?.(responseCode); } get requestResult() {