@@ -217,12 +217,13 @@ Pointer r6_to_pointer(SEXP self) {
217217 if (xp == R_NilValue) {
218218 cpp11::stop (" Invalid: self$`.:xp:.` is NULL" );
219219 }
220- #else
221- #if R_VERSION >= R_Version(4, 5, 0)
220+ #elif R_VERSION >= R_Version(4, 5, 0)
222221 SEXP xp = R_getVarEx (arrow::r::symbols::xp, self, FALSE , R_UnboundValue);
222+ if (xp == R_UnboundValue || xp == R_NilValue) {
223+ cpp11::stop (" Invalid: self$`.:xp:.` is NULL" );
224+ }
223225#else
224226 SEXP xp = Rf_findVarInFrame (self, arrow::r::symbols::xp);
225- #endif
226227 if (xp == R_UnboundValue || xp == R_NilValue) {
227228 cpp11::stop (" Invalid: self$`.:xp:.` is NULL" );
228229 }
@@ -244,12 +245,10 @@ void r6_reset_pointer(SEXP r6) {
244245 return ;
245246 }
246247 SEXP xp = R_getVar (arrow::r::symbols::xp, r6, FALSE );
247- #else
248- #if R_VERSION >= R_Version(4, 5, 0)
248+ #elif R_VERSION >= R_Version(4, 5, 0)
249249 SEXP xp = R_getVarEx (arrow::r::symbols::xp, r6, FALSE , R_UnboundValue);
250250#else
251251 SEXP xp = Rf_findVarInFrame (r6, arrow::r::symbols::xp);
252- #endif
253252#endif
254253 void * p = R_ExternalPtrAddr (xp);
255254 if (p != nullptr ) {
0 commit comments