From d7499e60157389488c0ba47e78e0942632e3f600 Mon Sep 17 00:00:00 2001 From: Joshua Goins Date: Sun, 11 May 2025 12:39:13 -0400 Subject: [PATCH] Fallback to 0,0,0 if we fail to find aetheryte destination --- src/world/connection.rs | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/src/world/connection.rs b/src/world/connection.rs index 9db73ca..e404b4e 100644 --- a/src/world/connection.rs +++ b/src/world/connection.rs @@ -384,14 +384,19 @@ impl ZoneConnection { let new_zone = Zone::load(&mut game_data.game_data, zone_id); // find it on the other side - let (object, _) = new_zone.find_pop_range(pop_range_id).unwrap(); - - // set the exit position - self.exit_position = Some(Position { - x: object.transform.translation[0], - y: object.transform.translation[1], - z: object.transform.translation[2], - }); + if let Some((object, _)) = new_zone.find_pop_range(pop_range_id) { + // set the exit position + self.exit_position = Some(Position { + x: object.transform.translation[0], + y: object.transform.translation[1], + z: object.transform.translation[2], + }); + } else { + tracing::warn!( + "Failed to find pop range in {}. Falling back to 0,0,0!", + new_zone.id + ); + } territory_type = zone_id; }