JAL-2405 additional checks for circular reference in context or dataset
[jalview.git] / src / jalview / datamodel / SequenceGroup.java
index e37c55e..1246d23 100755 (executable)
@@ -1358,7 +1358,7 @@ public class SequenceGroup implements AnnotatedCollectionI
     AnnotatedCollectionI ref = ctx;
     while (ref != null)
     {
-      if (ref == this)
+      if (ref == this || ref.getContext() == ctx)
       {
         throw new IllegalArgumentException(
                 "Circular reference in SequenceGroup.context");