diff --git a/xs/sources/xsArray.c b/xs/sources/xsArray.c index fbcfe8af19..f59e33d745 100644 --- a/xs/sources/xsArray.c +++ b/xs/sources/xsArray.c @@ -2340,13 +2340,9 @@ void fx_Array_prototype_sort(txMachine* the) mxTypeError("compare is no function"); } } - if (function) - fxSortArrayItems(the, function, C_NULL, fxGetArrayLength(the, mxThis)); - else { - if (array) - array = fxCheckArrayItems(the, array, 0, array->value.array.length); - fxSortArrayItems(the, function, array, fxGetArrayLength(the, mxThis)); - } + if (array) + array = fxCheckArrayItems(the, array, 0, array->value.array.length); + fxSortArrayItems(the, function, array, fxGetArrayLength(the, mxThis)); mxResult->kind = mxThis->kind; mxResult->value = mxThis->value; }