From 3d3f06be24b1c74887ca20fc000dfbef13549bae Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 6 May 2026 18:43:00 +0000 Subject: [PATCH] Fix candidates_formatted not found in print.mo_uncertainties() When there is only one match (candidates field is empty), the "Also matched:" block must be skipped. Wrapping it in if (candidates != "") prevents the error that arose after #288 narrowed filtr to one entry. https://claude.ai/code/session_01VH4Ju4Xq9aW1AHuoVbjGEo --- R/mo.R | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/R/mo.R b/R/mo.R index d2f79afd5..ce2413463 100755 --- a/R/mo.R +++ b/R/mo.R @@ -1023,17 +1023,19 @@ print.mo_uncertainties <- function(x, n = 10, ...) { message_(out2, as_note = FALSE) } - other_matches <- paste0( - "Also matched: ", - vector_and( - paste0( - candidates_formatted, - font_blue(paste0(" (", scores_formatted, ")"), collapse = NULL) - ), - quotes = FALSE, sort = FALSE + if (x[i, ]$candidates != "") { + other_matches <- paste0( + "Also matched: ", + vector_and( + paste0( + candidates_formatted, + font_blue(paste0(" (", scores_formatted, ")"), collapse = NULL) + ), + quotes = FALSE, sort = FALSE + ) ) - ) - message_(other_matches, as_note = FALSE) + message_(other_matches, as_note = FALSE) + } } if (isTRUE(any_maxed_out)) {