Skip to content

Commit af5339b

Browse files
authored
Handle statsPanel or settingsPanel being undefined. (#392)
Signed-off-by: timbotimbo <timbotimbo@users.noreply.github.com>
1 parent 81c3f52 commit af5339b

1 file changed

Lines changed: 9 additions & 9 deletions

File tree

Frontend/ui-library/src/Application/Application.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -487,15 +487,15 @@ export class Application {
487487
* Shows or hides the settings panel if clicked
488488
*/
489489
settingsClicked() {
490-
this.statsPanel.hide();
490+
this.statsPanel?.hide();
491491
this.settingsPanel.toggleVisibility();
492492
}
493493

494494
/**
495495
* Shows or hides the stats panel if clicked
496496
*/
497497
statsClicked() {
498-
this.settingsPanel.hide();
498+
this.settingsPanel?.hide();
499499
this.statsPanel.toggleVisibility();
500500
}
501501

@@ -583,7 +583,7 @@ export class Application {
583583
);
584584
}
585585
// disable starting a latency checks
586-
this.statsPanel.onDisconnect();
586+
this.statsPanel?.onDisconnect();
587587
}
588588

589589
/**
@@ -630,7 +630,7 @@ export class Application {
630630
if (!this.stream.config.isFlagEnabled(Flags.AutoPlayVideo)) {
631631
this.showPlayOverlay();
632632
}
633-
this.statsPanel.onVideoInitialized(this.stream);
633+
this.statsPanel?.onVideoInitialized(this.stream);
634634
}
635635

636636
/**
@@ -646,25 +646,25 @@ export class Application {
646646

647647
onInitialSettings(settings: InitialSettings) {
648648
if (settings.PixelStreamingSettings) {
649-
this.statsPanel.configure(settings.PixelStreamingSettings);
649+
this.statsPanel?.configure(settings.PixelStreamingSettings);
650650
}
651651
}
652652

653653
onStatsReceived(aggregatedStats: AggregatedStats) {
654654
// Grab all stats we can off the aggregated stats
655-
this.statsPanel.handleStats(aggregatedStats);
655+
this.statsPanel?.handleStats(aggregatedStats);
656656
}
657657

658658
onLatencyTestResults(latencyTimings: LatencyTestResults) {
659-
this.statsPanel.latencyTest.handleTestResult(latencyTimings);
659+
this.statsPanel?.latencyTest.handleTestResult(latencyTimings);
660660
}
661661

662662
onDataChannelLatencyTestResults(result: DataChannelLatencyTestResult) {
663-
this.statsPanel.dataChannelLatencyTest.handleTestResult(result);
663+
this.statsPanel?.dataChannelLatencyTest.handleTestResult(result);
664664
}
665665

666666
onPlayerCount(playerCount: number) {
667-
this.statsPanel.handlePlayerCount(playerCount);
667+
this.statsPanel?.handlePlayerCount(playerCount);
668668
}
669669

670670
handleStreamerListMessage(messageStreamingList: MessageStreamerList, autoSelectedStreamerId: string | null) {

0 commit comments

Comments
 (0)