From fca47a56584f279ad4a7480ef7dbcdf69d84a75e Mon Sep 17 00:00:00 2001
From: Dorchies David <david.dorchies@inrae.fr>
Date: Tue, 3 Aug 2021 16:53:54 +0200
Subject: [PATCH] fix(TransfoParam): issue with Cemaneige models

- Missing item "IsHyst" in `RunOptions$FeatFUN_MOD` causes crash

Regression after refactoring in #111
---
 R/CreateRunOptions.R | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/R/CreateRunOptions.R b/R/CreateRunOptions.R
index 8f5235bb..af299046 100644
--- a/R/CreateRunOptions.R
+++ b/R/CreateRunOptions.R
@@ -32,10 +32,12 @@ CreateRunOptions <- function(FUN_MOD, InputsModel,
   if (IsIntStore) {
     ObjectClass <- c(ObjectClass, "interception")
   }
-  if (IsHyst) {
-    ObjectClass <- c(ObjectClass, "hysteresis")
+  if ("CemaNeige" %in% FeatFUN_MOD$Class) {
     FeatFUN_MOD$IsHyst <- IsHyst
-    FeatFUN_MOD$NbParam <- FeatFUN_MOD$NbParam + 2
+    if (isHyst) {
+      ObjectClass <- c(ObjectClass, "hysteresis")
+      FeatFUN_MOD$NbParam <- FeatFUN_MOD$NbParam + 2
+    }
   }
 
   ## SD model
-- 
GitLab