Commit c6547925 authored by Andreas Kusalananda Kähäri's avatar Andreas Kusalananda Kähäri
Browse files

In fetch_all_by_logic_name(): If the provided logic name does not exist

in the ananlysis table, return a reference to an empty list.  Without
this change, all features would have been returned which would quickly
make the client run out of memory.
parent 07a64ab8
......@@ -535,9 +535,11 @@ sub fetch_all_by_Slice_constraint {
Arg [3] : string $logic_name
the logic name of the type of features to obtain
Example : $fs = $a->fetch_all_by_logic_name('foobar');
Description: Returns a listref of features created from the database.
only features with an analysis of type $logic_name will be
returned.
Description: Returns a listref of features created from the database.
only features with an analysis of type $logic_name will
be returned. If the logic name is invalid (not in the
analysis table), a reference to an empty list will be
returned.
Returntype : listref of Bio::EnsEMBL::SeqFeatures
Exceptions : thrown if no $logic_name
Caller : General
......@@ -554,6 +556,11 @@ sub fetch_all_by_logic_name {
my $constraint = $self->_logic_name_to_constraint( '', $logic_name );
if ( !defined($constraint) ) {
warning("Invalid logic name: $logic_name");
return [];
}
return $self->generic_fetch($constraint);
}
......@@ -1065,7 +1072,7 @@ sub _logic_name_to_constraint {
my $aa = $self->db->get_AnalysisAdaptor();
my $an = $aa->fetch_by_logic_name($logic_name);
if(!$an) {
if ( !defined($an) ) {
return undef;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment