diff --git a/modules/Bio/EnsEMBL/Utils/TranscriptAlleles.pm b/modules/Bio/EnsEMBL/Utils/TranscriptAlleles.pm
index 88637dee35e4e87f943a39665dee31baaedfa362..f6f6cb3154fca11978f92e90a2f403bdfcae3c9e 100644
--- a/modules/Bio/EnsEMBL/Utils/TranscriptAlleles.pm
+++ b/modules/Bio/EnsEMBL/Utils/TranscriptAlleles.pm
@@ -255,9 +255,8 @@ sub type_variation {
   }
 
   ##to find if a SNP is overlapping with the transcript of the regulatory region, also the SNP should be within 5kb on both side of the transcript, then check whether they overlapping
-
-  if ($tr and ref($tr) and $tr->isa('Bio::EnsEMBL::Transcript')) {
-    my $dbFunc = $tr->adaptor->db->get_db_adaptor("funcgen");
+  my $dbFunc = $tr->adaptor->db->get_db_adaptor("funcgen");
+  if ($tr and ref($tr) and $tr->isa('Bio::EnsEMBL::Transcript') and (defined $dbFunc)) {
     my $efa = $dbFunc->get_ExternalFeatureAdaptor();
     my $rfa = $dbFunc->get_RegulatoryFeatureAdaptor();
     my @rf;