Skip to content

Commit adf7337

Browse files
authored
Fix NULL caller function environment (#582)
1 parent 7601ca1 commit adf7337

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

R/deprecated.R

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,10 @@ deprecate_if_not_called_from_shiny <- function(old_name, new, version) {
164164

165165
function(...) {
166166
caller_fn_env <- environment(rlang::caller_fn())
167-
if (!identical(rlang::env_name(caller_fn_env), "namespace:shiny")) {
167+
if (!is.null(caller_fn_env) && rlang::is_environment(caller_fn_env)) {
168+
caller_fn_env <- rlang::env_name(caller_fn_env)
169+
}
170+
if (!identical(caller_fn_env, "namespace:shiny")) {
168171
msg <- sprintf(
169172
"`%s()` was deprecated in {bslib} version %s, use `%s()` instead.",
170173
old_name, version, new_name

0 commit comments

Comments
 (0)