Skip to content

Commit 44b63bb

Browse files
committed
fix missing R_UnboundValue in old path
1 parent be4a746 commit 44b63bb

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

inst/include/Rcpp/Function.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,12 +72,13 @@ namespace Rcpp{
7272
Function_Impl(const std::string& name, const std::string& ns) {
7373
#if R_VERSION < R_Version(4,5,0)
7474
Shield<SEXP> env(Rf_findVarInFrame(R_NamespaceRegistry, Rf_install(ns.c_str())));
75+
if (env == R_UnboundValue)
76+
stop("there is no namespace called \"%s\"", ns);
7577
#else
7678
Shield<SEXP> env(R_getVarEx(Rf_install(ns.c_str()), R_NamespaceRegistry, FALSE, R_NilValue));
77-
#endif
78-
if (env == R_NilValue) {
79+
if (env == R_NilValue)
7980
stop("there is no namespace called \"%s\"", ns);
80-
}
81+
#endif
8182
get_function(name, env);
8283
}
8384

0 commit comments

Comments
 (0)