From 5abed6c1cfd48a4246f536a490878369bc9c8a56 Mon Sep 17 00:00:00 2001 From: David Hugh-Jones Date: Thu, 15 Feb 2024 09:47:43 +0000 Subject: [PATCH] Fix 0-length bug in make_label --- R/aaa-utils.R | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/R/aaa-utils.R b/R/aaa-utils.R index 4435ddfb..450512d3 100644 --- a/R/aaa-utils.R +++ b/R/aaa-utils.R @@ -212,7 +212,9 @@ make_label <- function (ht) { has_knitr <- requireNamespace("knitr", quietly = TRUE) chunk_label <- if (has_knitr) knitr::opts_current$get("label") else NULL - if (grepl("^unnamed-chunk", chunk_label)) chunk_label <- NULL + if (length(chunk_label) > 0 && grepl("^unnamed-chunk", chunk_label)) { + chunk_label <- NULL + } if (is.na(lab) && getOption("huxtable.autolabel", TRUE) &&