From 13479398e0d6698ae214b3d15134c028e7108552 Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Mon, 28 Mar 2022 10:58:40 -0400 Subject: [PATCH] Bug 30386: Prevent search errors if deleted record still remains in search indexes If a bib is deleted, but for some reason doesn't get deleted from the search indexes, any search where that record is a result will produce the error: Can't call method "items" on an undefined value at /usr/share/koha/lib/C4/Search.pm line 2064. Test Plan: 1) Enable item-level_itypes 2) Create 3 records in Koha that share a word 3) Search for that word, note your 3+ results 4) Delete one of those recordst from the database using koha-mysql 5) Search for the word again 6) Note the error! 7) Apply this patch 8) Search for the word again 9) Note you get results! --- C4/Search.pm | 1 + 1 file changed, 1 insertion(+) diff --git a/C4/Search.pm b/C4/Search.pm index 9dfca44df3..f5276805dc 100644 --- a/C4/Search.pm +++ b/C4/Search.pm @@ -2000,6 +2000,7 @@ sub searchResults { } my $biblio_object = Koha::Biblios->find( $oldbiblio->{biblionumber} ); + next unless $biblio_object; $oldbiblio->{biblio_object} = $biblio_object; my $can_place_holds = 1; -- 2.32.0 (Apple Git-132)