From f514d5cc1525a85bb459e1175e715d53ed7cca39 Mon Sep 17 00:00:00 2001 From: Patrick Walton Date: Tue, 6 Feb 2024 23:17:34 -0800 Subject: [PATCH] Don't try to create a uniform buffer for light probes if there are no views. (#11751) Don't try to create a uniform buffer for light probes if there are no views. Fixes the panic on examples that have no views, such as `touch_input_events`. --- crates/bevy_pbr/src/light_probe/mod.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/crates/bevy_pbr/src/light_probe/mod.rs b/crates/bevy_pbr/src/light_probe/mod.rs index 7932534f39..30b042cc40 100644 --- a/crates/bevy_pbr/src/light_probe/mod.rs +++ b/crates/bevy_pbr/src/light_probe/mod.rs @@ -411,6 +411,11 @@ fn upload_light_probes( render_device: Res, render_queue: Res, ) { + // If there are no views, bail. + if views.is_empty() { + return; + } + // Initialize the uniform buffer writer. let mut writer = light_probes_buffer .get_writer(views.iter().len(), &render_device, &render_queue)