diff --git a/modules/Bio/EnsEMBL/DBSQL/DensityFeatureAdaptor.pm b/modules/Bio/EnsEMBL/DBSQL/DensityFeatureAdaptor.pm
index 46358ee1b1c0b893a2ac4ae7949cf180361aafad..d0dc81c873c99e76476f90628a8f6072784a32ad 100644
--- a/modules/Bio/EnsEMBL/DBSQL/DensityFeatureAdaptor.pm
+++ b/modules/Bio/EnsEMBL/DBSQL/DensityFeatureAdaptor.pm
@@ -210,7 +210,7 @@ sub fetch_all_by_Slice {
 
     #if we did not completely overlap the last feature, put it back on so
     #it can be partially used by the next block
-    if($fend < $f->{'end'}) {
+    if(defined($f) && (!defined($fend) || $fend < $f->{'end'})) {
       unshift(@features, $f);
     }