Skip to content

Commit

Permalink
Fix Tracks Data When Array Elements are null
Browse files Browse the repository at this point in the history
  • Loading branch information
jaruba committed Jun 10, 2024
1 parent d38c2fa commit 326ea8e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/tracksData.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ module.exports = function(url, cb) {
fetch('http://127.0.0.1:11470/tracks/'+encodeURIComponent(url)).then(function(resp) {
return resp.json();
}).then(function(tracks) {
var audioTracks = tracks.filter(function(el) { return el.type === 'audio'; });
var subsTracks = tracks.filter(function(el) { return el.type === 'text'; });
var audioTracks = tracks.filter(function(el) { return (el || {}).type === 'audio'; });
var subsTracks = tracks.filter(function(el) { return (el || {}).type === 'text'; });
cb({ audio: audioTracks, subs: subsTracks });
}).catch(function(err) {
// eslint-disable-next-line no-console
Expand Down

0 comments on commit 326ea8e

Please sign in to comment.