From: Jason Stephenson Date: Tue, 26 Jul 2011 19:32:58 +0000 (-0400) Subject: Always return [] when CStoreEditor search calls fail for any reason. X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=refs%2Fheads%2Fuser%2Fjason%40mvlc.org%2FCStoreEditor_undef_search_fix;p=working%2FEvergreen.git Always return [] when CStoreEditor search calls fail for any reason. Signed-off-by: Jason Stephenson --- 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' ) {