diff --git a/src/fifelse.c b/src/fifelse.c index e5d22a1eea..c2497b566d 100644 --- a/src/fifelse.c +++ b/src/fifelse.c @@ -102,9 +102,9 @@ SEXP fifelseR(SEXP l, SEXP a, SEXP b, SEXP na) { switch(tans) { case LGLSXP: { int *restrict pans = LOGICAL(ans); - const int *restrict pa; if (!na_a) pa = LOGICAL(a); - const int *restrict pb; if (!na_b) pb = LOGICAL(b); - const int *restrict pna; if (!na_n) pna = LOGICAL(na); + const int *restrict pa = na_a ? NULL : LOGICAL(a); + const int *restrict pb = na_b ? NULL : LOGICAL(b); + const int *restrict pna = na_n ? NULL : LOGICAL(na); const int na = NA_LOGICAL; #pragma omp parallel for num_threads(getDTthreads(len0, true)) for (int64_t i=0; i