diff --git a/Koha/Objects/Limit/Library.pm b/Koha/Objects/Limit/Library.pm index 2f9d2d2ec64..f16fca6a3d3 100644 --- a/Koha/Objects/Limit/Library.pm +++ b/Koha/Objects/Limit/Library.pm @@ -71,6 +71,7 @@ sub search_with_library_limits { ] }; + $params //= {}; $attributes //= {}; if ( exists $attributes->{join} ) { if ( ref $attributes->{join} eq 'ARRAY' ) { diff --git a/t/db_dependent/Koha/Patron/Attribute/Types.t b/t/db_dependent/Koha/Patron/Attribute/Types.t index 3df82bcfba7..c7bb0d2fbc0 100755 --- a/t/db_dependent/Koha/Patron/Attribute/Types.t +++ b/t/db_dependent/Koha/Patron/Attribute/Types.t @@ -388,7 +388,7 @@ subtest 'replace_library_limits() tests' => sub { subtest 'search_with_library_limits() tests' => sub { - plan tests => 5; + plan tests => 6; $schema->storage->txn_begin; @@ -427,6 +427,10 @@ subtest 'search_with_library_limits() tests' => sub { is( $results->count, 3, '3 attribute types are available with no library passed' ); + $results = Koha::Patron::Attribute::Types->search_with_library_limits(); + + is( $results->count, 3, 'No crash if no params passed' ); + $schema->storage->txn_rollback; };