From 16d80e27e14edf13ec9a7fb015da42d2f4a16036 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 19 Oct 2023 10:44:18 +1000 Subject: [PATCH] Handle statsPanel or settingsPanel being undefined. (#394) Signed-off-by: timbotimbo (cherry picked from commit af5339bec840c9ba8f5da5d4107a5a35ea641f1d) Co-authored-by: timbotimbo --- .../ui-library/src/Application/Application.ts | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/Frontend/ui-library/src/Application/Application.ts b/Frontend/ui-library/src/Application/Application.ts index 8ef496f59..d19504352 100644 --- a/Frontend/ui-library/src/Application/Application.ts +++ b/Frontend/ui-library/src/Application/Application.ts @@ -487,7 +487,7 @@ export class Application { * Shows or hides the settings panel if clicked */ settingsClicked() { - this.statsPanel.hide(); + this.statsPanel?.hide(); this.settingsPanel.toggleVisibility(); } @@ -495,7 +495,7 @@ export class Application { * Shows or hides the stats panel if clicked */ statsClicked() { - this.settingsPanel.hide(); + this.settingsPanel?.hide(); this.statsPanel.toggleVisibility(); } @@ -583,7 +583,7 @@ export class Application { ); } // disable starting a latency checks - this.statsPanel.onDisconnect(); + this.statsPanel?.onDisconnect(); } /** @@ -630,7 +630,7 @@ export class Application { if (!this.stream.config.isFlagEnabled(Flags.AutoPlayVideo)) { this.showPlayOverlay(); } - this.statsPanel.onVideoInitialized(this.stream); + this.statsPanel?.onVideoInitialized(this.stream); } /** @@ -646,25 +646,25 @@ export class Application { onInitialSettings(settings: InitialSettings) { if (settings.PixelStreamingSettings) { - this.statsPanel.configure(settings.PixelStreamingSettings); + this.statsPanel?.configure(settings.PixelStreamingSettings); } } onStatsReceived(aggregatedStats: AggregatedStats) { // Grab all stats we can off the aggregated stats - this.statsPanel.handleStats(aggregatedStats); + this.statsPanel?.handleStats(aggregatedStats); } onLatencyTestResults(latencyTimings: LatencyTestResults) { - this.statsPanel.latencyTest.handleTestResult(latencyTimings); + this.statsPanel?.latencyTest.handleTestResult(latencyTimings); } onDataChannelLatencyTestResults(result: DataChannelLatencyTestResult) { - this.statsPanel.dataChannelLatencyTest.handleTestResult(result); + this.statsPanel?.dataChannelLatencyTest.handleTestResult(result); } onPlayerCount(playerCount: number) { - this.statsPanel.handlePlayerCount(playerCount); + this.statsPanel?.handlePlayerCount(playerCount); } handleStreamerListMessage(messageStreamingList: MessageStreamerList, autoSelectedStreamerId: string | null) {