diff --git a/crates/bevy_core_pipeline/src/main_pass_2d.rs b/crates/bevy_core_pipeline/src/main_pass_2d.rs index 563edd3a9f527..c6c765ebc26ea 100644 --- a/crates/bevy_core_pipeline/src/main_pass_2d.rs +++ b/crates/bevy_core_pipeline/src/main_pass_2d.rs @@ -39,10 +39,10 @@ impl Node for MainPass2dNode { world: &World, ) -> Result<(), NodeRunError> { let view_entity = graph.get_input_entity(Self::IN_VIEW)?; - let (transparent_phase, target) = self - .query - .get_manual(world, view_entity) - .expect("view entity should exist"); + let (transparent_phase, target) = match self.query.get_manual(world, view_entity) { + Ok(query) => query, + Err(_) => return Ok(()), // No window + }; if transparent_phase.items.is_empty() { return Ok(()); diff --git a/crates/bevy_ui/src/render/render_pass.rs b/crates/bevy_ui/src/render/render_pass.rs index ccaa880e14a7e..47c7221616c9f 100644 --- a/crates/bevy_ui/src/render/render_pass.rs +++ b/crates/bevy_ui/src/render/render_pass.rs @@ -66,10 +66,10 @@ impl Node for UiPassNode { world: &World, ) -> Result<(), NodeRunError> { let view_entity = graph.get_input_entity(Self::IN_VIEW)?; - let (transparent_phase, target) = self - .query - .get_manual(world, view_entity) - .expect("view entity should exist"); + let (transparent_phase, target) = match self.query.get_manual(world, view_entity) { + Ok(query) => query, + Err(_) => return Ok(()), // No window + }; if transparent_phase.items.is_empty() { return Ok(());