Shifting array element down in the tree must be finished even if an error occurs

Fixes #1671

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
This commit is contained in:
Robert Fancsik
2017-07-11 14:09:29 +02:00
committed by yichoi
parent dbfb0170c1
commit 3d744c958f
2 changed files with 24 additions and 8 deletions
@@ -1113,16 +1113,16 @@ ecma_builtin_array_prototype_object_array_to_heap_helper (ecma_value_t array[],
}
}
/*
* Loop ended, either current child does not exist, or is less than swap.
* This means that 'swap' should be placed in the parent node.
*/
int parent = (child - 1) / 2;
JERRY_ASSERT (parent >= 0 && parent <= right);
array[parent] = swap;
if (ecma_is_value_empty (ret_value))
{
/*
* Loop ended, either current child does not exist, or is less than swap.
* This means that 'swap' should be placed in the parent node.
*/
int parent = (child - 1) / 2;
JERRY_ASSERT (parent >= 0 && parent <= right);
array[parent] = swap;
ret_value = ecma_make_simple_value (ECMA_SIMPLE_VALUE_UNDEFINED);
}