JAL-3187 handle no mapping / complement features without NPE
[jalview.git] / src / jalview / viewmodel / seqfeatures / FeatureRendererModel.java
index 4fc143e..f090190 100644 (file)
@@ -1156,10 +1156,11 @@ public abstract class FeatureRendererModel
   }
 
   /**
-   * Answers a (possibly empty) list of features in this alignment at a position
-   * (or range) which is mappable from the given sequence residue position in a
-   * mapped alignment. Features are returned in render order of feature type (on
-   * top last), with order within feature type undefined.
+   * Answers a bean containing a mapping, and a list of features in this
+   * alignment at a position (or range) which is mappable from the given
+   * sequence residue position in a mapped alignment. Features are returned in
+   * render order of feature type (on top last), with order within feature type
+   * undefined. If no features or mapping are found, answers null.
    * 
    * @param sequence
    * @param pos
@@ -1220,6 +1221,10 @@ public abstract class FeatureRendererModel
         break;
       }
     }
+    if (found.isEmpty())
+    {
+      return null;
+    }
 
     /*
      * sort by renderorder, inefficiently