[Commits] [wesnoth/wesnoth] 38e31a: Do not access non-existent unit

GitHub noreply at github.com
Tue Dec 19 21:05:25 UTC 2017


  Branch: refs/heads/master
  Home:   https://github.com/wesnoth/wesnoth
  Commit: 38e31aa61f60abed71bd266e6d2abe61035805b4
      https://github.com/wesnoth/wesnoth/commit/38e31aa61f60abed71bd266e6d2abe61035805b4
  Author: Gregory A Lundberg <gregory_lundberg at gmx.com>
  Date:   2017-12-19 (Tue, 19 Dec 2017)

  Changed paths:
    M data/lua/wml/harm_unit.lua
    M data/lua/wml/kill.lua

  Log Message:
  -----------
  Do not access non-existent unit

The [kill] tag can run animations. But it can also fire the `last breath` event, which can call [kill]. When we get back to the original [kill], the unit is gone, causing an error attempting to run the animations.

Added a check to ensure the unit is still on the map before we attempt to run the animations.

The Issue also requested that [harm_unit] pass the unit causing the harm into the [kill] tag so that `last breath` could use the secondary (killing) unit available like it does elsewhere.

Closes #2298





More information about the Commits mailing list