Fix crash in headless mode (#4476)

# Objective

Fixes #4440.

## Solution

Check if `RenderDevice` exists and add CI validation.
This commit is contained in:
Hennadii Chernyshchyk 2022-04-15 07:13:37 +00:00
parent c2a9d5843d
commit 3b81a50a1a
2 changed files with 9 additions and 1 deletions

View File

@ -0,0 +1,3 @@
(
exit_after: Some(100)
)

View File

@ -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