From: Chris W. <la...@us...> - 2001-10-31 22:00:12
|
Update of /cvsroot/openinteract/OpenInteract/pkg/results_manage/OpenInteract In directory usw-pr-cvs1:/tmp/cvs-serv1464/OpenInteract Modified Files: ResultsManage.pm Log Message: ensure that bad searches or searches that do not find anything don't mess everything up Index: ResultsManage.pm =================================================================== RCS file: /cvsroot/openinteract/OpenInteract/pkg/results_manage/OpenInteract/ResultsManage.pm,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** ResultsManage.pm 2001/10/11 03:17:27 1.9 --- ResultsManage.pm 2001/10/31 22:00:09 1.10 *************** *** 49,52 **** --- 49,64 ---- my ( $self, $to_save, $p ) = @_; my $R = OpenInteract::Request->instance; + + my ( $is_empty ); + + $is_empty++ unless( $to_save ); + $is_empty++ if ( ref $to_save eq 'ARRAY' and ! scalar @{ $to_save } ); + $is_empty++ if ( UNIVERSAL::isa( $to_save, 'SPOPS::Iterator' ) and ! $to_save->has_next ); + + if ( $is_empty ) { + $R->scrib( 0, "Bailing out of saving search results -- nothing to save!" ); + return undef; + } + $R->DEBUG && $R->scrib( 1, "Trying to save search results." ); |