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:
parent
0e1c424e48
commit
385266338a
@ -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))
|
||||
|
||||
--------------------
|
||||
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user