Fix playlist position error

This commit is contained in:
Chocobozzz 2021-04-27 09:02:35 +02:00
parent c9ae74d6bc
commit e1a5ad703f
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
1 changed files with 2 additions and 2 deletions

View File

@ -189,11 +189,11 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
this.queryParamsSub = this.route.queryParams.subscribe(queryParams => {
// Handle the ?playlistPosition
const positionParam = queryParams[ 'playlistPosition' ]
const positionParam = queryParams[ 'playlistPosition' ] ?? 1
this.playlistPosition = positionParam === 'last'
? -1 // Handle the "last" index
: parseInt(positionParam, 10)
: parseInt(positionParam + '', 10)
if (isNaN(this.playlistPosition)) {
console.error(`playlistPosition query param '${positionParam}' was parsed as NaN, defaulting to 1.`)