From 2ea7b551da3455625f5beed63fb4d0ea8515e2b3 Mon Sep 17 00:00:00 2001
From: Delaigue Olivier <olivier.delaigue@irstea.priv>
Date: Thu, 6 Jun 2019 19:02:01 +0200
Subject: [PATCH] v1.2.16.20 NEW: warning msg added when which = "CorQQ" and
 there is no 'Qobs' in plot.OutputsModel fun

---
 DESCRIPTION           |  2 +-
 NEWS.rmd              |  2 +-
 R/plot.OutputsModel.R | 10 ++++++----
 3 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/DESCRIPTION b/DESCRIPTION
index 70b5170a..4587a6a5 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.16.19
+Version: 1.2.16.20
 Date: 2019-06-06
 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 06ab20ca..36d879a1 100644
--- a/NEWS.rmd
+++ b/NEWS.rmd
@@ -14,7 +14,7 @@ output:
 
 
 
-### 1.2.16.19 Release Notes (2019-06-06)
+### 1.2.16.20 Release Notes (2019-06-06)
 
 
 #### New features
diff --git a/R/plot.OutputsModel.R b/R/plot.OutputsModel.R
index cf91f056..42d5fbab 100644
--- a/R/plot.OutputsModel.R
+++ b/R/plot.OutputsModel.R
@@ -116,12 +116,14 @@ plot.OutputsModel <- function(x, Qobs = NULL, IndPeriod_Plot = NULL, BasinArea =
     which <- c(which, whichAll)
   }
   if (is.null(Qobs)) {
-    if (length(which) == 1 & any(which %in% "Error")) {
-      stop("the 'Error' time series cannot be drawn if there is no 'Qobs'")
+    if (length(which) == 1 & any(which %in% c("CorQQ", "Error"))) {
+      stop(sprintf("the %s time series cannot be drawn if there is no 'Qobs'", shQuote(which)))
     }
-    if (length(which) != 1 & any(which %in% c("Error", "all"))) {
+    if (length(which) != 1 & any(which %in% c("CorQQ", "Error"))) {
+      BOOL_CorQQ <- FALSE
       BOOL_Error <- FALSE
-      warning("the 'Error' time series cannot be drawn if there is no 'Qobs'")
+      warning(sprintf("the %s time series cannot be drawn if there is no 'Qobs'",
+                      paste0(shQuote(c("CorQQ", "Error")), collapse = " and ")))
     }
   }
   
-- 
GitLab