From 4baec3009cad670d6df1332cdba8ae3aeecd493a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fran=C3=A7ois=20Grand?= <francois.grand@inrae.fr>
Date: Fri, 14 Apr 2023 17:15:18 +0200
Subject: [PATCH] refactor: ParallelStructure.CalcQ: early return on error

refs #302
---
 src/structure/parallel_structure.ts | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/structure/parallel_structure.ts b/src/structure/parallel_structure.ts
index ce283b19..25505177 100644
--- a/src/structure/parallel_structure.ts
+++ b/src/structure/parallel_structure.ts
@@ -116,6 +116,9 @@ export class ParallelStructure extends Nub {
         for (let i = 0; i < this._children.length; i++) {
             if (i !== iExcept) {
                 const res: Result = this._children[i].Calc("Q");
+                if (!res.ok) {
+                    return res;
+                }
                 qTot += res.vCalc;
                 // merge logs
                 calcRes.resultElement.log.addLog(res.log);
-- 
GitLab