Skip to content

Commit

Permalink
timeRangesToArray: handle ranges argument being undefined
Browse files Browse the repository at this point in the history
This occurs when the media element initially has no src set.
  • Loading branch information
martinandert committed Sep 10, 2017
1 parent 687acf7 commit 2782a6f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/shared/dom.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ export function toNumber(value) {
}

export function timeRangesToArray(ranges) {
if (!ranges) return [];
var array = [];
for (let i = 0; i < ranges.length; i += 1) {
array.push({ start: ranges.start(i), end: ranges.end(i) });
Expand Down Expand Up @@ -149,4 +150,4 @@ export function setInputType(input, type) {

export function setStyle(node, key, value) {
node.style.setProperty(key, value);
}
}
1 change: 1 addition & 0 deletions test/js/samples/media-bindings/expected-bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ function removeListener(node, event, handler) {
}

function timeRangesToArray(ranges) {
if (!ranges) return [];
var array = [];
for (let i = 0; i < ranges.length; i += 1) {
array.push({ start: ranges.start(i), end: ranges.end(i) });
Expand Down

0 comments on commit 2782a6f

Please sign in to comment.