diff --git a/R/flow.R b/R/flow.R index 8a852f0f58..46ba499364 100644 --- a/R/flow.R +++ b/R/flow.R @@ -738,10 +738,12 @@ st_min_cuts <- all_st_mincuts_impl dominator_tree <- function(graph, root, mode = c("out", "in", "all", "total")) { # Argument checks ensure_igraph(graph) - root <- as_igraph_vs(graph, root) - if (length(root) == 0) { + + if (missing(root) || is.null(root)) { cli::cli_abort("{.arg root} must be specified.") } + root <- as_igraph_vs(graph, root) + mode <- switch(igraph.match.arg(mode), "out" = 1, "in" = 2, diff --git a/tests/testthat/_snaps/flow.md b/tests/testthat/_snaps/flow.md index bf24e513c6..01e1e52f55 100644 --- a/tests/testthat/_snaps/flow.md +++ b/tests/testthat/_snaps/flow.md @@ -86,7 +86,7 @@ dominator_tree(g_tree) Condition Error in `dominator_tree()`: - ! argument "root" is missing, with no default + ! `root` must be specified. ---