From 7dde9a73d00342e9f04db0839ea8c8ef292217bf Mon Sep 17 00:00:00 2001
From: Delaigue Olivier <olivier.delaigue@irstea.priv>
Date: Wed, 13 Mar 2019 09:04:56 +0100
Subject: [PATCH] v1.2.9.6 BUG: match.fun now works on FUN_CRIT in
 CreateInputsCrit if it is a list

---
 DESCRIPTION          | 2 +-
 NEWS.rmd             | 2 +-
 R/CreateInputsCrit.R | 6 +++++-
 3 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/DESCRIPTION b/DESCRIPTION
index ad1c119c..bd5d3129 100644
--- a/DESCRIPTION
+++ b/DESCRIPTION
@@ -1,7 +1,7 @@
 Package: airGR
 Type: Package
 Title: Suite of GR Hydrological Models for Precipitation-Runoff Modelling
-Version: 1.2.9.5
+Version: 1.2.9.6
 Date: 2019-03-13
 Authors@R: c(
   person("Laurent", "Coron", role = c("aut", "trl"), comment = c(ORCID = "0000-0002-1503-6204")),
diff --git a/NEWS.rmd b/NEWS.rmd
index 5f49f786..048c11fa 100644
--- a/NEWS.rmd
+++ b/NEWS.rmd
@@ -13,7 +13,7 @@ output:
 
 
 
-### 1.2.9.5 Release Notes (2019-03-13) 
+### 1.2.9.6 Release Notes (2019-03-13) 
 
 
 
diff --git a/R/CreateInputsCrit.R b/R/CreateInputsCrit.R
index ea37616f..d41f1dbc 100644
--- a/R/CreateInputsCrit.R
+++ b/R/CreateInputsCrit.R
@@ -15,7 +15,6 @@ CreateInputsCrit <- function(FUN_CRIT,
   
   ObjectClass <- NULL
   
-  FUN_CRIT <- match.fun(FUN_CRIT)
   
   ## ---------- check arguments
   
@@ -91,6 +90,10 @@ CreateInputsCrit <- function(FUN_CRIT,
     }
   }
   
+  ## check 'FUN_CRIT'
+  listArgs$FUN_CRIT <- lapply(listArgs$FUN_CRIT, FUN = match.fun)
+  
+  
   ## check 'varObs'
   if (missing(varObs)) {
     listArgs$varObs <- as.list(rep("Q", times = length(listArgs$obs)))
@@ -99,6 +102,7 @@ CreateInputsCrit <- function(FUN_CRIT,
     # }
   }
   
+  
   ## check 'varObs' + 'RunOptions'
   if ("Q" %in% varObs & !inherits(RunOptions, "GR")) {
     stop("'varObs' cannot contain Q if a GR rainfall-runoff model is not used")
-- 
GitLab