1.13 Mac CTD on attack logic (?)
Moderator: Forum Moderators
Forum rules
Before reporting issues in this section, you must read the following topic:
Before reporting issues in this section, you must read the following topic:
1.13 Mac CTD on attack logic (?)
Playing "2p/3p vs Survival" on 1.13.
^ this autosave at start of turn will not crash.
^ this save after moving one unit a couple hexes will crash.
^ Quick glance looks like attack logic. Haven't debugged wesnoth before, so not sure where I should be starting/what I can ignore.
^ this autosave at start of turn will not crash.
^ this save after moving one unit a couple hexes will crash.
^ Quick glance looks like attack logic. Haven't debugged wesnoth before, so not sure where I should be starting/what I can ignore.
Re: 1.13 Mac CTD on attack logic (?)
Subsequently it didn't crash, but threw an error in https://github.com/wesnoth/wesnoth/blob ... target.lua on line 23, target was nil. So get_closest_enemy didn't properly return. Is wesnoth coding practice here to catch nils or ensure they're never sent?
Re: 1.13 Mac CTD on attack logic (?)
I'm not sure whether we have a strict coding practice for this, but I think it makes sense that ai_helper.get_closest_enemy() returns nil if it does not find such an enemy. And apparently I thought so 4 years ago too, as I clearly intentionally changed the behavior to that effect here.Jozrael wrote:Is wesnoth coding practice here to catch nils or ensure they're never sent?
So that line 23 should be changed to
if target then
I can change that, or if you want you can put in a change pull request since you found the error. Let me know and thanks for finding this.
PS: Btw, I read 'CTD' in the title as 'chance to die'. Took me a while to figure out what you were talking about.
SP campaigns: Galuldur's First Journey (1.12 & 1.14) & Grnk the Mighty (1.10 & 1.12)
AI experiments: Micro AIs (wiki, forum thread, known/fixed bugs), Fred, AI-demos add-on
AI experiments: Micro AIs (wiki, forum thread, known/fixed bugs), Fred, AI-demos add-on
Re: 1.13 Mac CTD on attack logic (?)
https://github.com/wesnoth/wesnoth/pull/2072 submitted. Unsure if it should be changed to the the line in the comment.
Re: 1.13 Mac CTD on attack logic (?)
Merged. Thanks for finding the problem and fixing it. (And I replied to your question in the comments of the pull request.)
SP campaigns: Galuldur's First Journey (1.12 & 1.14) & Grnk the Mighty (1.10 & 1.12)
AI experiments: Micro AIs (wiki, forum thread, known/fixed bugs), Fred, AI-demos add-on
AI experiments: Micro AIs (wiki, forum thread, known/fixed bugs), Fred, AI-demos add-on