Skip to content

Commit afb019e

Browse files
committed
avoid rare error when using GeomSf based extensions
1 parent 5cb124c commit afb019e

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

R/layer-sf.R

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,12 @@ LayerSf <- ggproto("LayerSf", Layer,
7878
geom_column <- function(data) {
7979
w <- which(vapply(data, inherits, TRUE, what = "sfc"))
8080
if (length(w) == 0) {
81-
"geometry" # avoids breaks when objects without geometry list-column are examined
81+
if (!is.character(data[["geometry"]])) {
82+
"geometry" # avoids breaks when objects without geometry list-column are examined
83+
} else {
84+
# Avoids a rare case where computed_geom_params$legend is present but there is no actual geometry column
85+
""
86+
}
8287
} else {
8388
# this may not be best in case more than one geometry list-column is present:
8489
if (length(w) > 1)

0 commit comments

Comments
 (0)