Fixed a crash when a unit has a move action queued, but the path is zero length

develop
JapaMala 2019-03-17 18:05:12 -05:00
parent c01dbc7cd2
commit 064b6959e4
1 changed files with 6 additions and 3 deletions

@ -1785,9 +1785,12 @@ static command_result GetUnitListInside(color_ostream &stream, const BlockReques
switch (action->type)
{
case unit_action_type::Move:
if (unit->path.path.x.size() > 0)
{
send_unit->set_subpos_x(lerp(0, unit->path.path.x[0] - unit->pos.x, (float)(action->data.move.timer_init - action->data.move.timer) / action->data.move.timer_init));
send_unit->set_subpos_y(lerp(0, unit->path.path.y[0] - unit->pos.y, (float)(action->data.move.timer_init - action->data.move.timer) / action->data.move.timer_init));
send_unit->set_subpos_z(lerp(0, unit->path.path.z[0] - unit->pos.z, (float)(action->data.move.timer_init - action->data.move.timer) / action->data.move.timer_init));
}
break;
default:
break;