From 2a3072beb0bebac1f2036899a87b44e559334477 Mon Sep 17 00:00:00 2001 From: Asteria Date: Sun, 15 May 2022 23:59:38 +0800 Subject: [PATCH] fix crash while minimizing window with ui camera --- crates/bevy_ui/src/render/render_pass.rs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/crates/bevy_ui/src/render/render_pass.rs b/crates/bevy_ui/src/render/render_pass.rs index ccaa880e14a7e..90d80296027e8 100644 --- a/crates/bevy_ui/src/render/render_pass.rs +++ b/crates/bevy_ui/src/render/render_pass.rs @@ -66,15 +66,16 @@ 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"); + + // If there is no view entity, do not try to process the render phase for the view + let (transparent_phase, target) = match self.query.get_manual(world, view_entity) { + Ok(it) => it, + _ => return Ok(()), + }; if transparent_phase.items.is_empty() { return Ok(()); } - let pass_descriptor = RenderPassDescriptor { label: Some("ui_pass"), color_attachments: &[RenderPassColorAttachment {