From ae7b0cbbcf05f7847dee765d8def9cf91052aec0 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 25 Oct 2022 15:07:58 +0200 Subject: Prevent error with metrics in HTTP player --- client/src/assets/player/shared/metrics/metrics-plugin.ts | 2 ++ 1 file changed, 2 insertions(+) (limited to 'client/src/assets') diff --git a/client/src/assets/player/shared/metrics/metrics-plugin.ts b/client/src/assets/player/shared/metrics/metrics-plugin.ts index 2844828da..0e296bef6 100644 --- a/client/src/assets/player/shared/metrics/metrics-plugin.ts +++ b/client/src/assets/player/shared/metrics/metrics-plugin.ts @@ -104,6 +104,8 @@ class MetricsPlugin extends Plugin { private trackBytes () { this.player.on('p2pInfo', (_event, data: PlayerNetworkInfo) => { + if (!data) return + this.downloadedBytesHTTP += data.http.downloaded - (this.lastPlayerNetworkInfo?.http.downloaded || 0) this.downloadedBytesP2P += data.p2p.downloaded - (this.lastPlayerNetworkInfo?.p2p.downloaded || 0) -- cgit v1.2.3