From 24ed3e0bf3542f8cf32ed03399dd455be4d5435f Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Sun, 10 Oct 2021 10:34:11 -0300 Subject: fix a bunch of crashes when acting before timeData ...is provided by the player --- ui.js | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/ui.js b/ui.js index df8d914..1331344 100644 --- a/ui.js +++ b/ui.js @@ -1257,7 +1257,9 @@ class AppElement extends FocusElement { if (qp.timeData) { let effectiveCurSec = qp.timeData.curSecTotal - const ts = this.getTimestampAtSec(qp.playingTrack, qp.timeData.curSecTotal) + const ts = (qp.timeData && + this.getTimestampAtSec(qp.playingTrack, qp.timeData.curSecTotal)) + if (ts) { effectiveCurSec -= ts.timestamp } @@ -1280,7 +1282,9 @@ class AppElement extends FocusElement { return } - const ts = this.getTimestampAtSec(qp.playingTrack, qp.timeData.curSecTotal) + const ts = (qp.timeData && + this.getTimestampAtSec(qp.playingTrack, qp.timeData.curSecTotal)) + if (ts) { qp.seekTo(ts.timestamp) return @@ -1296,7 +1300,9 @@ class AppElement extends FocusElement { return } - const ts = this.getTimestampAtSec(qp.playingTrack, qp.timeData.curSecTotal) + const ts = (qp.timeData && + this.getTimestampAtSec(qp.playingTrack, qp.timeData.curSecTotal)) + if (ts) { const timestampData = this.getTimestampData(qp.playingTrack) const playingTimestampIndex = timestampData.indexOf(ts) @@ -1317,7 +1323,8 @@ class AppElement extends FocusElement { return } - const ts = this.getTimestampAtSec(qp.playingTrack, qp.timeData.curSecTotal) + const ts = (qp.timeData && + this.getTimestampAtSec(qp.playingTrack, qp.timeData.curSecTotal)) if (ts) { const timestampData = this.getTimestampData(qp.playingTrack) -- cgit 1.3.0-6-gf8a5