Skip to content

Commit ede7d9f

Browse files
committed
preserve original logic
1 parent 8f64437 commit ede7d9f

File tree

1 file changed

+6
-11
lines changed

1 file changed

+6
-11
lines changed

r/src/arrow_cpp11.h

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -217,13 +217,12 @@ Pointer r6_to_pointer(SEXP self) {
217217
if (xp == R_NilValue) {
218218
cpp11::stop("Invalid: self$`.:xp:.` is NULL");
219219
}
220-
#elif R_VERSION >= R_Version(4, 5, 0)
220+
#else
221+
#if R_VERSION >= R_Version(4, 5, 0)
221222
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-
}
225223
#else
226224
SEXP xp = Rf_findVarInFrame(self, arrow::r::symbols::xp);
225+
#endif
227226
if (xp == R_UnboundValue || xp == R_NilValue) {
228227
cpp11::stop("Invalid: self$`.:xp:.` is NULL");
229228
}
@@ -245,16 +244,12 @@ void r6_reset_pointer(SEXP r6) {
245244
return;
246245
}
247246
SEXP xp = R_getVar(arrow::r::symbols::xp, r6, FALSE);
248-
#elif R_VERSION >= R_Version(4, 5, 0)
247+
#else
248+
#if R_VERSION >= R_Version(4, 5, 0)
249249
SEXP xp = R_getVarEx(arrow::r::symbols::xp, r6, FALSE, R_UnboundValue);
250-
if (xp == R_UnboundValue) {
251-
return;
252-
}
253250
#else
254251
SEXP xp = Rf_findVarInFrame(r6, arrow::r::symbols::xp);
255-
if (xp == R_UnboundValue) {
256-
return;
257-
}
252+
#endif
258253
#endif
259254
void* p = R_ExternalPtrAddr(xp);
260255
if (p != nullptr) {

0 commit comments

Comments
 (0)