aboutsummaryrefslogtreecommitdiff
path: root/azalea/src/pathfinder
diff options
context:
space:
mode:
authormanen <49951816+manen@users.noreply.github.com>2025-04-19 18:33:47 +0200
committerGitHub <noreply@github.com>2025-04-19 11:33:47 -0500
commit6c1b144970e331321501ce67beeabd1985d7e3bd (patch)
treebd9d1a62f6c3dc4ca91730faaf668d3cb51da817 /azalea/src/pathfinder
parent77f9d929b645ff7b265130bc667627e1cad14e6a (diff)
downloadazalea-drasl-6c1b144970e331321501ce67beeabd1985d7e3bd.tar.xz
remove `.unwrap()` from `wait_until_goto_target_reached` (#216)
* fix panics in `wait_until_goto_target_reached` * replace eprintln with warn --------- Co-authored-by: mat <git@matdoes.dev>
Diffstat (limited to 'azalea/src/pathfinder')
-rw-r--r--azalea/src/pathfinder/mod.rs7
1 files changed, 6 insertions, 1 deletions
diff --git a/azalea/src/pathfinder/mod.rs b/azalea/src/pathfinder/mod.rs
index bd61c4eb..f481350b 100644
--- a/azalea/src/pathfinder/mod.rs
+++ b/azalea/src/pathfinder/mod.rs
@@ -40,6 +40,7 @@ use futures_lite::future;
use goals::BlockPosGoal;
use parking_lot::RwLock;
use rel_block_pos::RelBlockPos;
+use tokio::sync::broadcast::error::RecvError;
use tracing::{debug, error, info, trace, warn};
pub use self::debug::PathfinderDebugParticles;
@@ -253,7 +254,11 @@ impl PathfinderClientExt for azalea_client::Client {
let mut tick_broadcaster = self.get_tick_broadcaster();
while !self.is_goto_target_reached() {
// check every tick
- tick_broadcaster.recv().await.unwrap();
+ match tick_broadcaster.recv().await {
+ Ok(_) => (),
+ Err(RecvError::Closed) => return,
+ Err(err) => warn!("{err}"),
+ };
}
}