diff --git a/src/extensions/dnatco/confal-pyramids/representation.ts b/src/extensions/dnatco/confal-pyramids/representation.ts
index f55cb6ef923bbd28f7e7a26c94498b5b95b3e19b..80d9e852af43a66b32f01d1634fbbca0463cc5ec 100644
--- a/src/extensions/dnatco/confal-pyramids/representation.ts
+++ b/src/extensions/dnatco/confal-pyramids/representation.ts
@@ -88,6 +88,8 @@ function createConfalPyramidsMesh(ctx: VisualContext, unit: Unit, structure: Str
     const it = new ConfalPyramidsIterator(structure, unit);
     while (it.hasNext) {
         const allPoints = it.move();
+        if (!allPoints)
+            continue;
 
         for (const points of allPoints) {
             const { O3, P, OP1, OP2, O5, confalScore } = points;
diff --git a/src/extensions/dnatco/confal-pyramids/util.ts b/src/extensions/dnatco/confal-pyramids/util.ts
index 6ab28c6f5c9ed549ca7651ec811ed12da11aa28b..c35f3270e893d684bc86e0eb082a64e2c0b9ca69 100644
--- a/src/extensions/dnatco/confal-pyramids/util.ts
+++ b/src/extensions/dnatco/confal-pyramids/util.ts
@@ -1,5 +1,5 @@
 /**
- * Copyright (c) 2018-2020 mol* contributors, licensed under MIT, See LICENSE file for more info.
+ * Copyright (c) 2018-2023 mol* contributors, licensed under MIT, See LICENSE file for more info.
  *
  * @author Michal MalĂ˝ <michal.maly@ibt.cas.cz>
  * @author Jiří Černý <jiri.cerny@ibt.cas.cz>
@@ -48,6 +48,10 @@ export class ConfalPyramidsIterator {
         this.residueOne = DnatcoUtil.copyResidue(this.residueTwo);
         this.residueTwo = DnatcoUtil.copyResidue(this.residueIt.move())!;
 
+        // Check for discontinuity
+        if (this.residueTwo.index !== (this.residueOne!.index + 1))
+            return void 0;
+
         return this.toPyramids(this.residueOne!, this.residueTwo);
     }