From a8193d43b2d47d9ac0872dcead792140f2be58bc Mon Sep 17 00:00:00 2001 From: Hiradpi <78161225+Hiradpi@users.noreply.github.com> Date: Sat, 4 Oct 2025 14:51:09 +0000 Subject: Don't panic on PathFoundEvent without having required components (#258) closes #257 --- azalea/src/pathfinder/mod.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/azalea/src/pathfinder/mod.rs b/azalea/src/pathfinder/mod.rs index 118a13ee..9bac46df 100644 --- a/azalea/src/pathfinder/mod.rs +++ b/azalea/src/pathfinder/mod.rs @@ -529,9 +529,11 @@ pub fn path_found_listener( mut commands: Commands, ) { for event in events.read() { - let (mut pathfinder, executing_path, instance_name, inventory, custom_state) = query - .get_mut(event.entity) - .expect("Path found for an entity that doesn't have a pathfinder"); + let Ok((mut pathfinder, executing_path, instance_name, inventory, custom_state)) = query + .get_mut(event.entity) else { + debug!("got path found event for an entity that can't pathfind"); + continue; + }; if let Some(path) = &event.path { if let Some(mut executing_path) = executing_path { let mut new_path = VecDeque::new(); -- cgit v1.2.3