[wesnoth-commits] [wesnoth/wesnoth] 0a612e: Lua: crash peacefully with [move_unit]

sevu noreply at github.com
Wed Sep 23 09:10:11 UTC 2020


  Branch: refs/heads/unit_placed_events
  Home:   https://github.com/wesnoth/wesnoth
  Commit: 0a612ec6451a1c3b69415b1be394fd514e99e55c
      https://github.com/wesnoth/wesnoth/commit/0a612ec6451a1c3b69415b1be394fd514e99e55c
  Author: Severin Glöckner <severin.gloeckner at stud.htwk-leipzig.de>
  Date:   2020-09-23 (Wed, 23 Sep 2020)

  Changed paths:
    M data/lua/wml/move_unit.lua

  Log Message:
  -----------
  Lua: crash peacefully with [move_unit]

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.

Add an abort function, which 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 then not available to pathfinding.





More information about the Commits mailing list