diff --git a/R/plot.R b/R/plot.R index 8dc0d1d4e..d97933718 100644 --- a/R/plot.R +++ b/R/plot.R @@ -132,9 +132,11 @@ plot.sfc_POINT = function(x, y, ..., pch = 1, cex = 1, col = 1, bg = 0, lwd = 1, bg = rep(bg, length.out = npts) cex = rep(cex, length.out = npts) mat = do.call(rbind, x) - ne = apply(mat, 1, function(x) all(is.finite(x))) # ne: not empty - points(mat[ne,, drop = FALSE], pch = pch[ne], col = col[ne], bg = bg[ne], cex = cex[ne], lwd = lwd, lty = lty, - type = type) + if (!is.null(mat)) { + ne = apply(mat, 1, function(x) all(is.finite(x))) # ne: not empty + points(mat[ne,, drop = FALSE], pch = pch[ne], col = col[ne], bg = bg[ne], + cex = cex[ne], lwd = lwd, lty = lty, type = type) + } } #' @name plot