Skip to content

Commit f802c5e

Browse files
authored
Fix #4008 allow NULL to be passed through new_mapped_discrete() (#4009)
1 parent 9ac9ff5 commit f802c5e

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

R/scale-discrete-.r

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,9 @@ ScaleDiscretePosition <- ggproto("ScaleDiscretePosition", ScaleDiscrete,
131131

132132
# TODO: This is a clear candidate for vctrs once we adopt it
133133
new_mapped_discrete <- function(x) {
134+
if (is.null(x)) {
135+
return(x)
136+
}
134137
if (!is.numeric(x)) {
135138
abort("`mapped_discrete` objects can only be created from numeric vectors")
136139
}

0 commit comments

Comments
 (0)