mirror of
https://github.com/wesnoth/wesnoth
synced 2025-04-30 01:47:13 +00:00

If there is an issue with to_x or to_y, such as a missmatching number of values, or none, then the function is aborted by the 2nd/3rd wml.error statement. At that place, current_unit:extract() was already called, so the function would not only fail, but also remove the unit. This commit unstores the unit prior to aborting. The alternative of extracting the unit later would break the tests, as it is then still using the hex, which is then not available to pathfinding.