Skip to content

Commit a122a7b

Browse files
committed
fix: handle potential error when retrieving device function in open_null_device
1 parent 2cc8cfc commit a122a7b

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

R/safe_graphics.R

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,10 @@ open_null_device <- function() {
4141
if (is.function(device_opt)) {
4242
device_fun <- device_opt
4343
} else if (is.character(device_opt) && length(device_opt) == 1L) {
44-
device_fun <- get(device_opt, mode = "function")
44+
device_fun <- tryCatch(
45+
get(device_opt, mode = "function"),
46+
error = function(e) NULL
47+
)
4548
}
4649

4750
if (is.function(device_fun)) {

0 commit comments

Comments
 (0)