diff --git a/changelog b/changelog index 6d263d0b7cc..a914426f7b1 100644 --- a/changelog +++ b/changelog @@ -189,6 +189,7 @@ Version 1.13.1+dev: * Fixed bug 23060: unit stat tooltips do not show. * wmllint, wmlscope, wmlindent and wmllint-1.4 now run on Python 3 * Text boxes tab completion now lists friends and whisperer nicks for easier answer (bug #9742) + * Avoid crash when planning moves on planned recruits (bug #18637) * Fixed cases of wrong unit type used in planning moves (bug #20299) * Fixed hang when attempting to make a screenshot from a non-existent map via command-line (bug #20900) diff --git a/src/whiteboard/move.cpp b/src/whiteboard/move.cpp index 2ee52b6e629..88368e23058 100644 --- a/src/whiteboard/move.cpp +++ b/src/whiteboard/move.cpp @@ -144,6 +144,13 @@ move::move(config const& cfg, bool hidden) void move::init() { + // If a unit is invalid, return immediately to avoid crashes such as trying to plan a move for a planned recruit. + // As per Bug #18637, this should be fixed so that planning moves on planned recruits work properly. + // The alternative is to disable movement on planned recruits altogether, + // possibly in select_or_action() where the fake unit is selected in the first place. + if (get_unit() == NULL) + return; + assert(get_unit()); unit_id_ = get_unit()->id();