]> git.rmz.io Git - dotfiles.git/commitdiff
awesome: tidy some lint diagnostics in mpd_widget
authorSamir Benmendil <me@rmz.io>
Tue, 20 Feb 2024 23:31:56 +0000 (23:31 +0000)
committerSamir Benmendil <me@rmz.io>
Wed, 21 Feb 2024 01:26:30 +0000 (01:26 +0000)
awesome/widgets/mpd_widget.lua

index 89deae19af6fbc7c363a11008120559c0b8c6874..ccd131e304ccc94042c0b086ceabe292cf994a12 100644 (file)
@@ -37,7 +37,7 @@ function widget:update_widget()
 end
 
 local function sec_to_min(sec)
-    m, s = math.modf((sec or 0.0) / 60)
+    local m, s = math.modf((sec or 0.0) / 60)
     return string.format('%d:%02d', m, math.floor(s * 60))
 end
 
@@ -129,6 +129,7 @@ function widget:popup_update()
         self._status = status
         local table = self:get_info()
         if not self._notification then return end
+        if not table then return end
         naughty.replace_text(self._notification, table.title, table.text)
     end)
 end