Skip to content

Commit

Permalink
abr-controller: protect hls.startLevel against runtime exception
Browse files Browse the repository at this point in the history
  • Loading branch information
mangui committed Nov 28, 2016
1 parent ccfaeff commit 5e0904d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/controller/abr-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -212,8 +212,8 @@ class AbrController extends EventHandler {
}

get minAutoLevel() {
let hls = this.hls, levels = hls.levels, minAutoBitrate = hls.config.minAutoBitrate;
for (let i = 0; i < levels.length; i++) {
let hls = this.hls, levels = hls.levels, minAutoBitrate = hls.config.minAutoBitrate, len = levels ? levels.length : 0;
for (let i = 0; i < len; i++) {
if (levels[i].bitrate > minAutoBitrate) {
return i;
}
Expand Down

0 comments on commit 5e0904d

Please sign in to comment.