From bb7551fa9c28f0b353989fd300cf61da9a399a30 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Wed, 18 Dec 2013 15:20:25 +0100 Subject: [PATCH] Bug 10858: FIX error if no biblio is selected Content-Type: text/plain; charset=utf-8 If the user launch a search a directly go to the opac detail page, an error occurs: malformed JSON string, neither array, object, number, string or atom, at character offset 0 (before "(end of string)") at /usr/share/perl5/JSON.pm line 171. Test plan: - remove the bibs_selected cookie - launch a search - click on a result - the page should be displayed correctly (cherry picked from commit 660e8d0437338a5d533d333123b56f0219aec252) Signed-off-by: Jonathan Druart Signed-off-by: Marcel de Rooy --- opac/opac-detail.pl | 3 +-- 1 files changed, 1 insertions(+), 2 deletions(-) diff --git a/opac/opac-detail.pl b/opac/opac-detail.pl index 6f52cfe..de0378a 100755 --- a/opac/opac-detail.pl +++ b/opac/opac-detail.pl @@ -214,8 +214,7 @@ if ($session->param('busc')) { my $searchAgain = 0; my ( $offset, $results_per_page ); - my $bibnums = $query->cookie('bibs_selected'); - $bibnums = JSON::from_json($bibnums); + my $bibnums = JSON::from_json( $query->cookie('bibs_selected') || '[]' ); if ( scalar( @$bibnums ) ) { $arrParamsBusc{count} = scalar( @$bibnums ); $arrParamsBusc{listBiblios} = join ',', @$bibnums; -- 1.7.7.6