1
0
mirror of https://github.com/videojs/video.js.git synced 2025-02-08 12:05:47 +02:00

@dmlap Check a component is a function before new-ing. closes #2814

This commit is contained in:
David LaPalomento 2015-11-16 10:18:09 -05:00 committed by Gary Katsevman
parent 0e1c424e48
commit 385266338a
2 changed files with 9 additions and 1 deletions

View File

@ -2,7 +2,7 @@ CHANGELOG
=========
## HEAD (Unreleased)
_(none)_
* @dmlap Check a component is a function before new-ing ([view](https://github.com/videojs/video.js/pull/2814))
--------------------

View File

@ -373,6 +373,14 @@ class Component {
throw new Error(`Component ${componentClassName} does not exist`);
}
// data stored directly on the videojs object may be
// misidentified as a component to retain
// backwards-compatibility with 4.x. check to make sure the
// component class can be instantiated.
if (typeof ComponentClass !== 'function') {
return null;
}
component = new ComponentClass(this.player_ || this, options);
// child is a component instance