Skip to content

Commit

Permalink
addresses #1666
Browse files Browse the repository at this point in the history
  • Loading branch information
edzer committed May 3, 2021
1 parent 721a7a4 commit 4911f5a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
14 changes: 7 additions & 7 deletions R/valid.R
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ st_is_valid.sfc = function(x, ..., NA_on_exception = TRUE, reason = FALSE) {
ret
} else
CPL_geos_is_valid_reason(x)
} else if (! NA_on_exception) {
} else #if (! NA_on_exception) {
CPL_geos_is_valid(x, as.logical(NA_on_exception))
} else {
ret = vector("logical", length(x))
for (i in seq_along(x))
ret[i] = CPL_geos_is_valid(x[i], as.logical(NA_on_exception))
ret
}
# } else {
# ret = vector("logical", length(x))
# for (i in seq_along(x))
# ret[i] = CPL_geos_is_valid(x[i], as.logical(NA_on_exception))
# ret
# }
}

#' @export
Expand Down
2 changes: 2 additions & 0 deletions src/geos.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -528,8 +528,10 @@ Rcpp::LogicalVector CPL_geos_is_valid(Rcpp::List sfc, bool NA_on_exception = tru

int notice = 0;
if (NA_on_exception) {
/*
if (sfc.size() > 1)
Rcpp::stop("NA_on_exception will only work reliably with length 1 sfc objects"); // #nocov
*/
#ifdef HAVE350
GEOSContext_setNoticeMessageHandler_r(hGEOSCtxt,
(GEOSMessageHandler_r) __emptyNoticeHandler, (void *) &notice);
Expand Down

0 comments on commit 4911f5a

Please sign in to comment.