From afb5939ba4862e4716f035c9b322fc3f9ebd858f Mon Sep 17 00:00:00 2001 From: Moshe Maor Date: Mon, 9 Dec 2024 09:24:06 +0200 Subject: [PATCH] FEC-14226: protect against case where tracks are not ready (#801) ### Description of the Changes Please add a detailed description of the change, whether it's an enhancement or a bugfix. If the PR is related to an open issue please link to it. ### CheckLists - [ ] changes have been done against master branch, and PR does not conflict - [ ] new unit / functional tests have been added (whenever applicable) - [ ] test are passing in local environment - [ ] Travis tests are passing (or test results are not worse than on master branch :)) - [ ] Docs have been updated --- src/player.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/player.ts b/src/player.ts index f936860e..ba760c77 100644 --- a/src/player.ts +++ b/src/player.ts @@ -1445,7 +1445,7 @@ export default class Player extends FakeEventTarget { * @private */ private _applyABRRestriction(config: any): void { - if (Utils.Object.hasPropertyPath(config, 'abr.restrictions') && this._engine && this._tracks.length) { + if (Utils.Object.hasPropertyPath(config, 'abr.restrictions') && this._engine && this._tracks?.length) { const { restrictions } = this._config.abr; const videoTracks: VideoTrack[] = this._tracks.filter((track) => track instanceof VideoTrack); const newVideoTracks = filterTracksByRestriction(videoTracks, restrictions);