···97979898// check if queue has a valid current track
9999const hasValidTrack = () =>
100100- isValidQueueIndex(state.queueIndex, state.queue.length);
100100+ state.queueIndex >= 0 && state.queueIndex < state.queue.length;
101101102102// helper to play a track at given queue index
103103const playQueueTrack = (idx) => {
···161161// move to next track when current song ends
162162function handleTrackEnd() {
163163 if (
164164- isValidQueueIndex(state.queueIndex, state.queue.length) &&
164164+ state.queueIndex >= 0 &&
165165+ state.queueIndex < state.queue.length &&
165166 state.settings.scrobbling
166167 ) {
167168 state.api.scrobble(state.queue[state.queueIndex].id).catch(() => {});