Skip to content

Commit 39363c6

Browse files
committed
add drop FALSE to split_code
1 parent 7d3138b commit 39363c6

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

R/utils-get_code_dependency.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -473,7 +473,7 @@ get_call_breaks <- function(code) {
473473
matrix(c(max(x$line2), max(x$col2)))
474474
}
475475
))
476-
call_breaks <- call_breaks[-nrow(call_breaks), ] # breaks in between needed only
476+
call_breaks <- call_breaks[-nrow(call_breaks), , drop = FALSE] # breaks in between needed only
477477
colnames(call_breaks) <- c("line", "col")
478478
call_breaks
479479
}
@@ -491,7 +491,7 @@ split_code <- function(code) {
491491
if (nrow(call_breaks) == 0) {
492492
return(code)
493493
}
494-
call_breaks <- call_breaks[order(call_breaks[, "line"], call_breaks[, "col"]), ]
494+
call_breaks <- call_breaks[order(call_breaks[, "line"], call_breaks[, "col"]), , drop = FALSE]
495495
code_split <- strsplit(code, split = "\n", fixed = TRUE)[[1]]
496496
char_count_lines <- c(0, cumsum(sapply(code_split, nchar, USE.NAMES = FALSE) + 1), -1)[seq_along(code_split)]
497497

0 commit comments

Comments
 (0)