From 762c8960263408502f50e62e604ba3553d9ce7e5 Mon Sep 17 00:00:00 2001 From: Andrew Yates <ayates@ebi.ac.uk> Date: Fri, 19 Aug 2011 11:20:51 +0000 Subject: [PATCH] Made equals() methods null safe --- modules/Bio/EnsEMBL/Exon.pm | 1 + modules/Bio/EnsEMBL/Gene.pm | 1 + 2 files changed, 2 insertions(+) diff --git a/modules/Bio/EnsEMBL/Exon.pm b/modules/Bio/EnsEMBL/Exon.pm index 868c0cd8bd..425a1d683e 100755 --- a/modules/Bio/EnsEMBL/Exon.pm +++ b/modules/Bio/EnsEMBL/Exon.pm @@ -849,6 +849,7 @@ sub equals { my ( $self, $exon ) = @_; if ( $self eq $exon ) { return 1 } + if ( ! defined $exon ) { return 0 } assert_ref( $exon, 'Bio::EnsEMBL::Exon' ); diff --git a/modules/Bio/EnsEMBL/Gene.pm b/modules/Bio/EnsEMBL/Gene.pm index 22bbd0b0ce..3fcfd94723 100755 --- a/modules/Bio/EnsEMBL/Gene.pm +++ b/modules/Bio/EnsEMBL/Gene.pm @@ -390,6 +390,7 @@ sub equals { my ( $self, $gene ) = @_; if ( $self eq $gene ) { return 1 } + if ( ! defined $gene ) { return 0 } assert_ref( $gene, 'Bio::EnsEMBL::Gene' ); -- GitLab