From 58d603ec4428217bc7cfc3e66b782015a62e8c53 Mon Sep 17 00:00:00 2001 From: Reinhold Kainhofer <reinhold@kainhofer.com> Date: Mon, 9 Mar 2020 21:14:04 +0100 Subject: [PATCH] Fix error (missing is.null check) in dimnames<- --- R/exportInsuranceContract_xlsx.R | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/R/exportInsuranceContract_xlsx.R b/R/exportInsuranceContract_xlsx.R index 6f7eac2..3dc1e98 100644 --- a/R/exportInsuranceContract_xlsx.R +++ b/R/exportInsuranceContract_xlsx.R @@ -78,9 +78,10 @@ writePremiumCoefficients = function(wb, sheet, values, tarif = NULL, type = "ben rows = crow:(crow + 5), cols = ccol + 1); # The first column of the benefits coefficients is for "age", which we want to remove - mod = function(vals) { as.data.frame(t(vals)) }; + mod = function(vals) { if (!is.null(vals)) as.data.frame(t(vals)) else NULL }; if (type == "costs") { mod = function(vals) { + if (is.null(vals)) return(NULL) vals = setInsuranceValuesLabels(vals); newvals = vals; dimn = dimnames(newvals); -- GitLab