Bug 8435: (follow-up) prevent t/00-load.t failing
[koha.git] / reports / itemtypes.plugin
index 388649f..e4164a5 100755 (executable)
@@ -31,10 +31,13 @@ use C4::Branch; # GetBranches
 =cut
 
 sub set_parameters {
-       my ($template) = @_;
-    my $userbranch = C4::Context->userenv->{'branch'};
-     $template->param( branchloop => GetBranchesLoop($userbranch) );
-       return $template;
+    my ($template) = @_;
+    my $userbranch = '';
+    if (C4::Context->userenv && C4::Context->userenv->{'branch'}) {
+        $userbranch = C4::Context->userenv->{'branch'};
+    }
+    $template->param( branchloop => GetBranchesLoop($userbranch) );
+    return $template;
 }
 
 sub calculate {