aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHiradpi <78161225+Hiradpi@users.noreply.github.com>2025-10-04 14:51:09 +0000
committerGitHub <noreply@github.com>2025-10-04 09:51:09 -0500
commita8193d43b2d47d9ac0872dcead792140f2be58bc (patch)
tree3350d567341e2b051b24b03b85afcdd36617f50b
parent6545ddb020e756327e02d7f31fdb6a5f62f6107e (diff)
downloadazalea-drasl-a8193d43b2d47d9ac0872dcead792140f2be58bc.tar.xz
Don't panic on PathFoundEvent without having required components (#258)
closes #257
-rw-r--r--azalea/src/pathfinder/mod.rs8
1 files 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();