From 692e573aefe6e8fd5a021e6e147926d5c66a0a55 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Mon, 9 Mar 2020 11:02:54 +0100 Subject: [PATCH] Bug 20443: Do not explode if attribute does not have a valid av Template process failed: undef error - Can't call method "lib" on an undefined value at /kohadevbox/koha/Koha/Patron/Attribute.pm line 109. at /kohadevbox/koha/C4/Templates.pm line 122 We should not crash as it if the attribute is linked to an invalid authorised value (for instance the AV has been deleted) We must provide a check in the search_for_data_inconsistencies.pl script Signed-off-by: Nick Clemens --- Koha/Patron/Attribute.pm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Koha/Patron/Attribute.pm b/Koha/Patron/Attribute.pm index 9118a7f812..5afd674149 100644 --- a/Koha/Patron/Attribute.pm +++ b/Koha/Patron/Attribute.pm @@ -106,7 +106,8 @@ displayed instead of the code. sub description { my ( $self) = @_; if ( $self->type->authorised_value_category ) { - return $self->authorised_value->lib; + my $av = $self->authorised_value; + return $av ? $av->lib : ""; } return $self->attribute; } -- 2.20.1