Skip to content

Commit cb15077

Browse files
committed
avoid passing nil to string.sub
1 parent d58ed66 commit cb15077

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

mpris-widget/init.lua

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,13 @@ function playerctl:watch(timeout, callback, widget)
5050
position = position,
5151
length = length,
5252
album = words[7],
53-
year = string.sub(words[8], 0, 4),
5453
progress = progress,
5554
}
5655

56+
if words[8] ~= nil then
57+
metadata.year = string.sub(words[8], 0, 4)
58+
end
59+
5760
callback(widget, metadata)
5861
end
5962

0 commit comments

Comments
 (0)