Skip to content

Commit 91a6d25

Browse files
committed
Early exit earlier
1 parent b174986 commit 91a6d25

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

R/guides-.R

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,9 @@ guides <- function(...) {
7171
if (length(args) > 0) {
7272
if (is.list(args[[1]]) && !is.guide(args[[1]])) args <- args[[1]]
7373
args <- rename_aes(args)
74+
# If there are no guides do nothing
75+
if (length(args) == 0) {
76+
return(NULL)
7477
}
7578

7679
idx_false <- vapply(args, isFALSE, FUN.VALUE = logical(1L))
@@ -84,11 +87,6 @@ guides <- function(...) {
8487
return(guides_list(guides = args))
8588
}
8689

87-
# If there are no guides, do nothing
88-
if (length(args) == 0) {
89-
return(NULL)
90-
}
91-
9290
# Raise warning about unnamed guides
9391
nms <- names(args)
9492
if (is.null(nms)) {

0 commit comments

Comments
 (0)