From 778c50fab59b6aa6b2c845bb02ac46dda6ea7ec8 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Mon, 25 Sep 2023 11:29:20 +0100 Subject: [PATCH] Bug 34737: (follow-up) Code more defensively This patch adds some defense for errant preference lines, allowing for empty lines, comment lines and even skipping easily identified malformed lines. --- C4/SIP/ILS/Transaction/Checkin.pm | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/C4/SIP/ILS/Transaction/Checkin.pm b/C4/SIP/ILS/Transaction/Checkin.pm index bf4a17720a5..c10b0bf2207 100644 --- a/C4/SIP/ILS/Transaction/Checkin.pm +++ b/C4/SIP/ILS/Transaction/Checkin.pm @@ -268,6 +268,13 @@ sub _get_sort_bin { my $rule = 0; RULE: foreach my $line (@lines) { + # Skip empty lines and comments + next if ( $line =~ /^\s*($|#)/ ); + + # Skip malformed lines + my $count = () = $line =~ /\Q:/g; + next if ( --$count % 3 ); + my $match = 0; # Split the line into fields -- 2.41.0