1
0
Fork 0

Fix #12236: Ship pathfinder causes crash when ship is already at destination (#12238)

pull/12277/head
Kuhnovic 2024-03-08 23:46:13 +01:00
parent 110925b6a8
commit df5e183461
1 changed files with 4 additions and 1 deletions

View File

@ -275,7 +275,10 @@ public:
}
node = node->m_parent;
}
assert(!path_cache.empty());
/* A empty path means we are already at the destination. The pathfinder shouldn't have been called at all.
* Return a random reachable trackdir to hopefully nudge the ship out of this strange situation. */
if (path_cache.empty()) return GetRandomFollowUpTrackdir(v, src_tile, trackdir, true);
/* Take out the last trackdir as the result. */
const Trackdir result = path_cache.front();