The warn comes from undefined C4::Context->userenv->{branch}.
Can be triggered by calling mainpage.pl when being logged out in staff.
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
for my $l ( @$libraries ) {
if ( defined $selected and $l->{branchcode} eq $selected
- or not defined $selected and C4::Context->userenv and $l->{branchcode} eq C4::Context->userenv->{branch}
+ or not defined $selected and C4::Context->userenv and $l->{branchcode} eq ( C4::Context->userenv->{branch} // q{} )
) {
$l->{selected} = 1;
}