From 3bf15e4af9e54586417056a819071e984bd72576 Mon Sep 17 00:00:00 2001 From: Samir Benmendil Date: Mon, 22 Aug 2022 11:37:21 +0100 Subject: [PATCH] awesome: added robustness when there's no current song --- awesome/widgets/mpd_widget.lua | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/awesome/widgets/mpd_widget.lua b/awesome/widgets/mpd_widget.lua index 9a698f7..89deae1 100644 --- a/awesome/widgets/mpd_widget.lua +++ b/awesome/widgets/mpd_widget.lua @@ -64,6 +64,7 @@ end function widget:get_info() local status, song = self._status, self._currentsong if not status.state then return nil end + if not status.song then return nil end local info = {} info.title = status.state .. " " .. status.song .. "/" .. status.playlistlength .. " " .. song_duration(status.elapsed, status.duration) @@ -166,6 +167,10 @@ function widget:run() conn:send("currentsong", function(_, song) self._currentsong = song + if not song then + self:update_widget() + return + end conn:albumart(song.file, function(_, art) self._albumart = art self:update_widget() -- 2.48.1