From 0135556249d5b1a2296dbb3a46eaba31fa9230a0 Mon Sep 17 00:00:00 2001 From: Damyan Ivanov Date: Thu, 18 Nov 2021 06:14:09 +0000 Subject: [PATCH] no warnings on undef usage when idle waiting results in no changes this is normal when the idle mode is stopped with 'noidle' --- lib/App/MPD/Feeder.pm | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/lib/App/MPD/Feeder.pm b/lib/App/MPD/Feeder.pm index ed5d276..7da421a 100644 --- a/lib/App/MPD/Feeder.pm +++ b/lib/App/MPD/Feeder.pm @@ -237,14 +237,22 @@ use constant DEFAULT_CONFIG_FILE => '/etc/mpd-feeder/mpd-feeder.conf'; sub { my $result = shift; - if ( $result->{changed} eq 'database' ) { + undef $idler; + + my $changed = $result->{changed} // ''; + + if ( $changed eq 'database' ) { $db_needs_update = 1; $self->prepare_to_wait_idle; } - elsif ( $result->{changed} eq 'playlist' ) { + elsif ( $changed eq 'playlist' ) { $self->queue_songs( undef, sub { $self->prepare_to_wait_idle } ); } + elsif ( $changed eq '' ) { + $log->debug("got no changes from idle"); + $self->prepare_to_wait_idle; + } else { use JSON; $log->warn( -- 2.39.5