From 02b8ebf94e41430d2c90b39e3348fc647522f697 Mon Sep 17 00:00:00 2001 From: Damyan Ivanov Date: Tue, 16 Nov 2021 06:02:29 +0000 Subject: [PATCH] do not crash when the playlist is cleared the 'playlist' idle event returns no result in this case which lead to an attempt to dereference undefined value --- lib/App/MPD/Feeder.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/App/MPD/Feeder.pm b/lib/App/MPD/Feeder.pm index 66f3ce1..ed5d276 100644 --- a/lib/App/MPD/Feeder.pm +++ b/lib/App/MPD/Feeder.pm @@ -174,7 +174,7 @@ use constant DEFAULT_CONFIG_FILE => '/etc/mpd-feeder/mpd-feeder.conf'; $self->connect_mpd; $mpd->send('playlist')->on_done( sub { - my $present = scalar @{ $_[0] }; + my $present = scalar @{ $_[0] // [] }; $log->notice( "Playlist contains $present songs. Wanted: " . $opt->target_queue_length ); -- 2.39.5