Skip to content

fix(player): guard against missing src/type in updateSourceCaches_#9202

Open
okxint wants to merge 1 commit into
videojs:mainfrom
okxint:fix/update-source-caches-undefined-props
Open

fix(player): guard against missing src/type in updateSourceCaches_#9202
okxint wants to merge 1 commit into
videojs:mainfrom
okxint:fix/update-source-caches-undefined-props

Conversation

@okxint

@okxint okxint commented Jun 16, 2026

Copy link
Copy Markdown

When srcObj doesn't have src or type keys, both get set to undefined, which then poisons the source cache in unexpected ways. Added optional chaining + nullish coalescing fallback to empty string to match how the rest of the method handles missing values.

Closes #9185

When srcObj is an object without src or type properties (e.g. null or {}),
accessing srcObj.src and srcObj.type silently produced undefined values,
leading to unexpected cache state. Use optional chaining with nullish
coalescing to fall back to empty string in those cases.

Fixes videojs#9185
@welcome

welcome Bot commented Jun 16, 2026

Copy link
Copy Markdown

💖 Thanks for opening this pull request! 💖

Things that will help get your PR across the finish line:

  • Run npm run lint -- --errors locally to catch formatting errors earlier.
  • Include tests when adding/changing behavior.
  • Include screenshots and animated GIFs whenever possible.

We get a lot of pull requests on this repo, so please be patient and we will get back to you as soon as we can.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: updateSourceCaches_() assumes srcObj has src and type properties

1 participant