From 0fd2a2efc280b609f3598ea791def2aeb3fb1d48 Mon Sep 17 00:00:00 2001
From: Kieron Taylor <ktaylor@ebi.ac.uk>
Date: Fri, 3 Jun 2016 17:25:00 +0100
Subject: [PATCH] [ENSCORESW-1724] Stop users fetching slices by regions with
 <empty string> as the end coordinate. Bug allowed unbound slices.

---
 modules/Bio/EnsEMBL/DBSQL/SliceAdaptor.pm | 4 ++--
 modules/t/slice.t                         | 8 ++++++++
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/modules/Bio/EnsEMBL/DBSQL/SliceAdaptor.pm b/modules/Bio/EnsEMBL/DBSQL/SliceAdaptor.pm
index c3fda732c0..07d63f4eaf 100644
--- a/modules/Bio/EnsEMBL/DBSQL/SliceAdaptor.pm
+++ b/modules/Bio/EnsEMBL/DBSQL/SliceAdaptor.pm
@@ -207,8 +207,8 @@ sub fetch_by_region {
        $strand, $version, $no_fuzz )
     = @_;
 
-  assert_integer($start, 'start') if $start;
-  assert_integer($end, 'end') if $end;
+  assert_integer($start, 'start') if defined $start;
+  assert_integer($end, 'end') if defined $end;
 
   if ( !defined($start) )  { $start  = 1 }
   if ( !defined($strand) ) { $strand = 1 }
diff --git a/modules/t/slice.t b/modules/t/slice.t
index 8db789513b..073b3e7cf2 100644
--- a/modules/t/slice.t
+++ b/modules/t/slice.t
@@ -621,5 +621,13 @@ isa_ok($slice, 'Bio::EnsEMBL::Slice');
 $genome_component = $slice->get_genome_component($slice);
 is($genome_component, 'D', "Genome component from slice");
 
+# Deal with rare user case of requesting a region with end = ''
+
+dies_ok(sub { $slice_adaptor->fetch_by_region('chromosome', 20, 1, '') },'Stringy null region end causes an exception');
+
+  
+
+
+
 done_testing();
 
-- 
GitLab