Skip to content

Conversation

teunbrand
Copy link
Collaborator

This PR fixes a regression from #5967 that is detectable as:

ggplot2/revdep/problems.md

Lines 155 to 156 in d31c051

Error in if (new_name %in% existing) { : argument is of length zero
Calls: plot_history ... add_ggplot -> ggplot_add -> ggplot_add.Layer -> new_layer_names

Briefly, this error occurs when the constructor call doesn't get captured cleanly, like in the following case:

library(ggplot2)
rlang::call_name(do.call(geom_point, list())$constructor)
#> NULL

Created on 2024-09-10 with reprex v2.1.1

In this PR, we construct a fallback name based on the geom's ggproto class.

@teunbrand
Copy link
Collaborator Author

Thanks for the review!

@teunbrand teunbrand merged commit d742881 into tidyverse:main Sep 16, 2024
13 checks passed
@teunbrand teunbrand deleted the empty_layer_names branch September 16, 2024 08:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants