From 1f2753908b8e523583894b94cd2230eae43eda15 Mon Sep 17 00:00:00 2001
From: Delaigue Olivier <olivier.delaigue@irstea.priv>
Date: Thu, 30 Aug 2018 07:59:21 +0200
Subject: [PATCH] v1.0.13.8 CreateInputsCrit returns an error when epsilon <= 0

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

diff --git a/DESCRIPTION b/DESCRIPTION
index 4a96bb05..4b22ecb5 100644
--- a/DESCRIPTION
+++ b/DESCRIPTION
@@ -1,8 +1,8 @@
 Package: airGR
 Type: Package
 Title: Suite of GR Hydrological Models for Precipitation-Runoff Modelling
-Version: 1.0.13.7
-Date: 2018-08-29
+Version: 1.0.13.8
+Date: 2018-08-30
 Authors@R: c(
   person("Laurent", "Coron", role = c("aut", "trl"), comment = c(ORCID = "0000-0002-1503-6204")),
   person("Charles", "Perrin", role = c("aut", "ths"), comment = c(ORCID = "0000-0001-8552-1881")),
diff --git a/NEWS.rmd b/NEWS.rmd
index 617d0fe4..0c75d1dd 100644
--- a/NEWS.rmd
+++ b/NEWS.rmd
@@ -14,7 +14,7 @@ output:
 
 
 
-### 1.0.13.7 Release Notes (2018-08-29) 
+### 1.0.13.8 Release Notes (2018-08-30) 
 
 
 #### Deprectated and defunct
@@ -32,6 +32,8 @@ output:
 
 - <code>CreateCalibOptions()</code> now returns an error when all the parameters are set and a warning message when all the parameters are not set <code>FixedParam</code> in the <code>FixedParam</code> argument.
 
+- <code>CreateInputsCrit()</code> now returns an error when <code>epsilon</code is not positive.
+
 
 #### Minor user-visible changes
 
diff --git a/R/CreateInputsCrit.R b/R/CreateInputsCrit.R
index 4c2d61c9..8a6aa1d1 100644
--- a/R/CreateInputsCrit.R
+++ b/R/CreateInputsCrit.R
@@ -89,9 +89,8 @@ CreateInputsCrit <- function(FUN_CRIT,
     }
 
     if (!is.null(epsilon)) {
-      if (!is.vector(epsilon) |
-          length(epsilon) != 1 | !is.numeric(epsilon)) {
-        stop("epsilon must be single numeric value \n")
+      if (!is.vector(epsilon) | length(epsilon) != 1 | !is.numeric(epsilon) | any(epsilon <= 0)) {
+        stop("epsilon must a be single positive value \n")
         return(NULL)
       }
       epsilon = as.double(epsilon)
-- 
GitLab