From f0c94671f9ff7ca1122e2781e89d8115a67c8ef0 Mon Sep 17 00:00:00 2001 From: Andrew Yates <ayates@ebi.ac.uk> Date: Fri, 19 Aug 2011 11:14:34 +0000 Subject: [PATCH] Made both equals() methods null safe --- modules/Bio/EnsEMBL/Feature.pm | 3 +++ modules/Bio/EnsEMBL/Transcript.pm | 1 + 2 files changed, 4 insertions(+) diff --git a/modules/Bio/EnsEMBL/Feature.pm b/modules/Bio/EnsEMBL/Feature.pm index 669e1ba8a3..e06a3f4a19 100644 --- a/modules/Bio/EnsEMBL/Feature.pm +++ b/modules/Bio/EnsEMBL/Feature.pm @@ -435,6 +435,9 @@ sub equals { if ( $self eq $feature ) { return 1; } + if ( ! defined $feature ) { + return 0; + } assert_ref( $feature, 'Bio::EnsEMBL::Feature' ); diff --git a/modules/Bio/EnsEMBL/Transcript.pm b/modules/Bio/EnsEMBL/Transcript.pm index fe54e42227..722d447606 100755 --- a/modules/Bio/EnsEMBL/Transcript.pm +++ b/modules/Bio/EnsEMBL/Transcript.pm @@ -2092,6 +2092,7 @@ sub equals { my ( $self, $transcript ) = @_; if ( $self eq $transcript ) { return 1 } + if ( ! defined $transcript ) { return 0 } assert_ref( $transcript, 'Bio::EnsEMBL::Transcript' ); -- GitLab