Skip to content

Commit

Permalink
PROTECT() Scalar* objects
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelChirico authored Jul 12, 2024
1 parent 3c3baa9 commit 56e8a13
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/frollR.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ SEXP coerceToRealListR(SEXP obj) {
SEXP this_obj = VECTOR_ELT(obj, i);
if (!(isReal(this_obj) || isInteger(this_obj) || isLogical(this_obj)))
error(_("x must be of type numeric or logical, or a list, data.frame or data.table of such"));
SET_VECTOR_ELT(x, i, coerceAs(this_obj, ScalarReal(NA_REAL), /*copyArg=*/ScalarLogical(false))); // copyArg=false will make type-class match to return as-is, no copy
SET_VECTOR_ELT(x, i, coerceAs(this_obj, PROTECT(ScalarReal(NA_REAL)), /*copyArg=*/PROTECT(ScalarLogical(false)))); // copyArg=false will make type-class match to return as-is, no copy
UNPROTECT(2); // scalar arguments to coerceAs()
}
UNPROTECT(protecti);
return x;
Expand Down

0 comments on commit 56e8a13

Please sign in to comment.