From 7b59425029ebcb209e07663ab7da1cedf1912661 Mon Sep 17 00:00:00 2001 From: Miguel Ángel Moreno Date: Mon, 2 Dec 2024 00:49:19 +0100 Subject: feat: add guard for player on source change --- src/frontend/tubo/player/events.cljs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/frontend/tubo/player/events.cljs b/src/frontend/tubo/player/events.cljs index 6350029..d189e56 100644 --- a/src/frontend/tubo/player/events.cljs +++ b/src/frontend/tubo/player/events.cljs @@ -18,9 +18,10 @@ (rf/reg-fx :player/src (fn [{:keys [player src current-pos]}] - (set! (.-src @player) (clj->js src)) - (set! (.-onended @player) - #(rf/dispatch [:queue/change-pos (inc current-pos)])))) + (when (and player @player) + (set! (.-src @player) (clj->js src)) + (set! (.-onended @player) + #(rf/dispatch [:queue/change-pos (inc current-pos)]))))) (rf/reg-fx :player/loop -- cgit v1.2.3