From f0ffbad0df39de7cca4d39adc6f45c9f01b96136 Mon Sep 17 00:00:00 2001 From: Justin Spahr-Summers Date: Thu, 18 Jul 2024 22:26:30 +0100 Subject: [PATCH] Don't crash if galaxy map nodes/edges are clicked and player is destroyed --- galaxy/map/galaxy_map.gd | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/galaxy/map/galaxy_map.gd b/galaxy/map/galaxy_map.gd index 4ab322ac..17f4ee0b 100644 --- a/galaxy/map/galaxy_map.gd +++ b/galaxy/map/galaxy_map.gd @@ -67,7 +67,7 @@ func _on_window_close_requested() -> void: self.queue_free() func _on_system_clicked(star_system: StarSystem, _system_node: GalaxyMapSystem) -> void: - if self.hyperdrive_system.jumping: + if not is_instance_valid(self.hyperdrive_system) or self.hyperdrive_system.jumping: return if star_system.name not in self.hyperdrive_system.current_system().connections: @@ -76,7 +76,7 @@ func _on_system_clicked(star_system: StarSystem, _system_node: GalaxyMapSystem) self.hyperdrive_system.jump_destination = star_system func _on_hyperlane_clicked(from_system: StarSystem, to_system: StarSystem, _hyperlane_node: GalaxyMapHyperlane) -> void: - if self.hyperdrive_system.jumping: + if not is_instance_valid(self.hyperdrive_system) or self.hyperdrive_system.jumping: return var current_system := self.hyperdrive_system.current_system()