Skip to content

Commit 3572521

Browse files
committed
Check for non-zero length before calling list2env(). Fixes #1444
1 parent d36e919 commit 3572521

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

DESCRIPTION

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
Package: ggplot2
2-
Version: 2.0.0.9000
2+
Version: 2.0.0.9001
33
Authors@R: c(
44
person("Hadley", "Wickham", , "hadley@rstudio.com", c("aut", "cre")),
55
person("Winston", "Chang", , "winston@rstudio.com", "aut"),
@@ -14,7 +14,7 @@ Description: An implementation of the grammar of graphics in R. It combines the
1414
data to aesthetic attributes. See http://ggplot2.org for more information,
1515
documentation and examples.
1616
Depends:
17-
R (>= 2.14)
17+
R (>= 3.1)
1818
Imports:
1919
digest,
2020
grid,

NEWS.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
## Bug fixes and minor improvements
44

5+
* Fixed a compatibility issue with `ggproto` and R versions prior to 3.1.2.
6+
(#1444)
7+
58
* `stat-density-2d()` no longer ignores the `h` parameter.
69

710
* `stat-density-2d()` now accepts `bins` and `binwidth` parameters

R/ggproto.r

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,12 @@ ggproto <- function(`_class` = NULL, `_inherit` = NULL, ...) {
3636
if (length(members) != sum(nzchar(names(members)))) {
3737
stop("All members of a ggproto object must be named.")
3838
}
39-
list2env(members, envir = e)
39+
40+
# R <3.1.2 will error when list2env() is given an empty list, so we need to
41+
# check length. https://github.com/hadley/ggplot2/issues/1444
42+
if (length(members) > 0) {
43+
list2env(members, envir = e)
44+
}
4045

4146
if (!is.null(`_inherit`)) {
4247
if (!is.ggproto(`_inherit`)) {

0 commit comments

Comments
 (0)