Skip to content

Fix panic in poll_for_sketch_updates when message system not initialized - #218

Open
pepc84 wants to merge 1 commit into
processing:mainfrom
pepc84:fix/poll-sketch-updates-panic
Open

Fix panic in poll_for_sketch_updates when message system not initialized#218
pepc84 wants to merge 1 commit into
processing:mainfrom
pepc84:fix/poll-sketch-updates-panic

Conversation

@pepc84

@pepc84 pepc84 commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

sketch_update_handler uses MessageReader<AssetEvent> 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 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" }))

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" }))
@catilac
catilac requested a review from tychedelia August 4, 2026 14:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant