Guard against possible invalid tech usage

This commit is contained in:
Gabe Kangas 2022-04-22 10:49:13 -07:00
parent a8fff63500
commit 7935bcf5f3
No known key found for this signature in database
GPG key ID: 9A56337728BC81EA

View file

@ -292,6 +292,11 @@ class OwncastPlayer {
// Quality selected
newMenuItem.on('click', function () {
// If for some reason tech doesn't exist, then don't do anything
if (!tech) {
console.warn('Invalid attempt to access null player tech');
return;
}
// Only enable this single, selected representation.
tech.vhs.representations().forEach(function (rep, index) {
rep.enabled(index === item.index);