From 2496631e33e4d85e21bb580dc8cd2a961e1cb8e9 Mon Sep 17 00:00:00 2001 From: raziman Date: Mon, 22 Jun 2020 21:17:44 +0800 Subject: [PATCH] fix deleting unhiglighted song in queue --- queue.go | 7 +++++-- start.go | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/queue.go b/queue.go index 28c1927..996542a 100644 --- a/queue.go +++ b/queue.go @@ -36,8 +36,11 @@ func Queue(player *Player) *tview.List { prev() case 'd': index := list.GetCurrentItem() - player.Remove(index) - list.RemoveItem(index) + + if index != -1 { + player.Remove(index) + list.RemoveItem(index) + } } diff --git a/start.go b/start.go index 4db7ad2..bc52921 100644 --- a/start.go +++ b/start.go @@ -21,7 +21,7 @@ func start(app *tview.Application) { player := &Player{} - child3 := PlayingBar(app) + child3 := PlayingBar(app, player) child2 := Queue(player) child1 := Playlist(child2, child3, player)