From 7ea6e406e9357bd788e9432331f60cf70a3f0128 Mon Sep 17 00:00:00 2001 From: AlekseyManetov Date: Wed, 10 Apr 2024 16:21:05 +0200 Subject: [PATCH] [Server]: add check that sorting is array for getOrderComparer func --- server/helpers/getOrderComparer.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/helpers/getOrderComparer.js b/server/helpers/getOrderComparer.js index 977670d4f2..ee4f844b80 100644 --- a/server/helpers/getOrderComparer.js +++ b/server/helpers/getOrderComparer.js @@ -15,7 +15,7 @@ function compareScalars(a, b, order) { return order; } function getOrderComparer(sorting) { - if (!sorting || sorting.length === 0) { + if (!sorting || sorting.length === 0 || !Array.isArray(sorting)) { return eqPredicate; } const sortingOrders = sorting.map(function (s) { return s.direction === 'desc' ? -1 : 1; });