From cc873d371cb68c81336afca0420fa5b0bf51e9d7 Mon Sep 17 00:00:00 2001 From: Dan Wells Date: Thu, 21 Feb 2019 11:31:20 -0500 Subject: [PATCH] LP#1749475 Protect against missing pubdate in biblio sort The lack of date1 data in some records was causing this code to crash, as an attempt was made to read textContent from nothingness. Similar to the publisher code right above, let's protect against such cases. Signed-off-by: Dan Wells Signed-off-by: Galen Charlton Signed-off-by: Michele Morgan --- .../src/perlmods/lib/OpenILS/Application/Trigger/Reactor.pm | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Trigger/Reactor.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Trigger/Reactor.pm index f011417cfc..cb7d5b818d 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Trigger/Reactor.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Trigger/Reactor.pm @@ -449,8 +449,9 @@ $_TT_helpers = { $$bib{item_type} = $xml->findnodes('//*[local-name()="attributes"]/*[local-name()="field"][@name="item_type"]')->get_node(1)->getAttribute('coded-value'); my $p = $xml->findnodes('//*[@tag="260" or @tag="264"]/*[@code="b"]')->get_node(1); $$bib{publisher} = $p ? $p->textContent : ''; - $$bib{pubdatesort} = $$bib{pubdate} = $xml->findnodes('//*[local-name()="attributes"]/*[local-name()="field"][@name="date1"]')->get_node(1)->textContent; - $$bib{pubdatesort} = lc($$bib{pubdatesort}); + my $pd = $xml->findnodes('//*[local-name()="attributes"]/*[local-name()="field"][@name="date1"]')->get_node(1); + $$bib{pubdate} = $pd ? $pd->textContent : ''; + $$bib{pubdatesort} = lc($$bib{pubdate}); $$bib{isbn} = $xml->findnodes('//*[@tag="020"]/*[@code="a"]')->to_literal_delimited(', '); $$bib{issn} = $xml->findnodes('//*[@tag="022"]/*[@code="a"]')->to_literal_delimited(', '); $$bib{upc} = $xml->findnodes('//*[@tag="024"]/*[@code="a"]')->to_literal_delimited(', '); -- 2.43.2