videojs / m3u8-parser

An m3u8 parser.
Other
473 stars 98 forks source link

Set currentUri correctly before clearing it #132

Closed iroha7941 closed 3 years ago

iroha7941 commented 3 years ago

The previous code would set fields in currentUri and then immediately clear it, which was obviously wrong.

gkatsev commented 3 years ago

Were you seeing a particular issue here? Theoretically, the code as written should work because we're adding properties to the object it should still be udpated in that array we added to. A simplified version of what's happening here

var a = [];
var o = {};
a.push(o);
o.foo = 5;
a[0].foo // 5
iroha7941 commented 3 years ago

Ah, right. Sorry for my mistake, I'm still a Javascript noob and missed that a reference was being pushed. I'll just close tihs pull request. Thanks for the feedback, sorry for the trouble.

gkatsev commented 3 years ago

No worries. PRs like these have definitely found problems in the past, so, better to have it than not.