From 29e4e00a5d5d9b9cc2956cbb92771a35e82d2468 Mon Sep 17 00:00:00 2001
From: Reinhold Kainhofer <reinhold@kainhofer.com>
Date: Mon, 11 Sep 2017 00:22:26 +0000
Subject: [PATCH] Fix plotting mortality trends (leave out reference if not
 given, otherwise the code will try to access NULL)

---
 R/plot.mortalityTable.R | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/R/plot.mortalityTable.R b/R/plot.mortalityTable.R
index edfbd41..2bc839d 100644
--- a/R/plot.mortalityTable.R
+++ b/R/plot.mortalityTable.R
@@ -60,7 +60,11 @@
 #' @export
 plot.mortalityTable = function(x, ..., reference = NULL, trend = FALSE) {
     if (!missing(trend) && isTRUE(trend)) {
-        plotMortalityTrend(x, ..., reference = reference)
+        if (!missing(reference) && !is.null(reference)) {
+            plotMortalityTrend(x, ..., reference = reference)
+        } else {
+            plotMortalityTrend(x, ...)
+        }
     } else if (!missing(reference) && !is.null(reference)) {
         plotMortalityTableComparisons(x, ..., reference = reference)
     } else {
-- 
GitLab