From b390ebf63515e32c10eb6f9ca7b5fc4ce4a69713 Mon Sep 17 00:00:00 2001 From: Jason Stephenson Date: Tue, 26 Jul 2011 15:32:58 -0400 Subject: [PATCH] Always return [] when CStoreEditor search calls fail for any reason. Signed-off-by: Jason Stephenson --- .../src/perlmods/lib/OpenILS/Utils/CStoreEditor.pm | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Utils/CStoreEditor.pm b/Open-ILS/src/perlmods/lib/OpenILS/Utils/CStoreEditor.pm index 03237caf3a..f2d3c5030e 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Utils/CStoreEditor.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Utils/CStoreEditor.pm @@ -730,7 +730,10 @@ sub runmethod { my $e = $self->_checkperm($type, $a, $$options{permorg}); if($e) { $self->event($e); - return undef; + # Per method comment, search always returns [] + # on failure. Much other code depends on that + # behavior. + return ($action eq 'search') ? [] : undef; } } @@ -759,10 +762,16 @@ sub runmethod { $self->event( OpenILS::Event->new( 'DATABASE_QUERY_FAILED', payload => $arg, debug => "$err" )); - return undef; + # Per method comment, search always returns [] + # on failure. Much other code depends on that + # behavior. + return ($action eq 'search') ? [] : undef; } - return undef; + # Per method comment, search always returns [] + # on failure. Much other code depends on that + # behavior. + return ($action eq 'search') ? [] : undef; } if( $action eq 'create' and $obj == 0 ) { @@ -777,7 +786,10 @@ sub runmethod { $self->event( OpenILS::Event->new( 'DATABASE_QUERY_FAILED', payload => $arg, debug => "$err" )); - return undef; + # Per method comment, search always returns [] + # on failure. Much other code depends on that + # behavior. + return ($action eq 'search') ? [] : undef; } if( $action eq 'search' ) { -- 2.11.0