Skip to content

Commit

Permalink
Fix crash in headless mode (#4476)
Browse files Browse the repository at this point in the history
# Objective

Fixes #4440.

## Solution

Check if `RenderDevice` exists and add CI validation.
  • Loading branch information
Shatur committed Apr 15, 2022
1 parent c2a9d58 commit 3b81a50
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .github/example-run/headless_defaults.ron
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
(
exit_after: Some(100)
)
7 changes: 6 additions & 1 deletion crates/bevy_pbr/src/light.rs
Original file line number Diff line number Diff line change
Expand Up @@ -642,8 +642,13 @@ pub(crate) fn assign_lights_to_clusters(
lights_query: Query<(Entity, &GlobalTransform, &PointLight, &Visibility)>,
mut lights: Local<Vec<PointLightAssignmentData>>,
mut max_point_lights_warning_emitted: Local<bool>,
render_device: Res<RenderDevice>,
render_device: Option<Res<RenderDevice>>,
) {
let render_device = match render_device {
Some(render_device) => render_device,
None => return,
};

global_lights.entities.clear();
lights.clear();
// collect just the relevant light query data into a persisted vec to avoid reallocating each frame
Expand Down

0 comments on commit 3b81a50

Please sign in to comment.