Skip to content

Commit c4b2336

Browse files
committed
Fix panic in poll_for_sketch_updates when message system not initialized
sketch_update_handler uses MessageReader<AssetEvent<Sketch>> which requires Bevy's message system to be initialized. When called via run_system_cached before the app is fully started, it returns SystemParamValidationError instead of a value, causing unwrap() to panic. Fix: use .ok().flatten() to return None gracefully when the system isn't ready, matching the expected Option<Sketch> return type. Fixes: thread panicked at crates/processing_render/src/lib.rs called Result::unwrap() on Err(Failed(SystemParamValidationError { message: "Message not initialized", field: "::messages" }))
1 parent acc5b41 commit c4b2336

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

  • crates/processing_render/src

crates/processing_render/src/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1480,7 +1480,8 @@ pub fn poll_for_sketch_updates() -> error::Result<Option<sketch::Sketch>> {
14801480
Ok(app
14811481
.world_mut()
14821482
.run_system_cached(sketch::sketch_update_handler)
1483-
.unwrap())
1483+
.ok()
1484+
.flatten())
14841485
})
14851486
}
14861487

0 commit comments

Comments
 (0)