From a482ea39d66b63e956dd9aecdc917247b60a03f1 Mon Sep 17 00:00:00 2001
From: "francois.grand" <francois.grand@irstea.fr>
Date: Wed, 18 Apr 2018 12:56:22 +0200
Subject: [PATCH] =?UTF-8?q?=20#46=20SectionParametree.getParameter()=20:?=
 =?UTF-8?q?=20correction=20bug=20ne=20retournant=20pas=20un=20param=C3=A8t?=
 =?UTF-8?q?re=20du=20genre=20Hs,=20B,=20P,=20...?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 src/section/section_nub.ts | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/src/section/section_nub.ts b/src/section/section_nub.ts
index 476a83bf..ad9068b1 100644
--- a/src/section/section_nub.ts
+++ b/src/section/section_nub.ts
@@ -84,18 +84,15 @@ export class SectionParametree extends Nub {
     }
 
     public getParameter(name: string): ParamDefinition {
-        try {
-            return super.getParameter(name);
-        }
-        catch (e) {
+        let res = super.getParameter(name);
+        if (res === undefined) {
             // pas trouvé -> il s'agit peut être d'une variable dans le genre Hs, B, P, ...
-            const res = this._sectionVars[name];
+            res = this._sectionVars[name];
 
             if (!res)
                 throw new Error(`SectionParametree.getParameter() : nom de paramètre ${name} incorrect`);
-
-            return res;
         }
+        return res;
     }
 
     public getFirstAnalyticalParameter(): ParamDefinition {
-- 
GitLab