Fix crash in headless mode (#4476)
# Objective Fixes #4440. ## Solution Check if `RenderDevice` exists and add CI validation.
This commit is contained in:
parent
c2a9d5843d
commit
3b81a50a1a
3
.github/example-run/headless_defaults.ron
vendored
Normal file
3
.github/example-run/headless_defaults.ron
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
(
|
||||||
|
exit_after: Some(100)
|
||||||
|
)
|
@ -642,8 +642,13 @@ pub(crate) fn assign_lights_to_clusters(
|
|||||||
lights_query: Query<(Entity, &GlobalTransform, &PointLight, &Visibility)>,
|
lights_query: Query<(Entity, &GlobalTransform, &PointLight, &Visibility)>,
|
||||||
mut lights: Local<Vec<PointLightAssignmentData>>,
|
mut lights: Local<Vec<PointLightAssignmentData>>,
|
||||||
mut max_point_lights_warning_emitted: Local<bool>,
|
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();
|
global_lights.entities.clear();
|
||||||
lights.clear();
|
lights.clear();
|
||||||
// collect just the relevant light query data into a persisted vec to avoid reallocating each frame
|
// collect just the relevant light query data into a persisted vec to avoid reallocating each frame
|
||||||
|
Loading…
Reference in New Issue
Block a user