From 69d7278cf30ad81d2bebdf739b32222e253ca206 Mon Sep 17 00:00:00 2001 From: LFBarreto Date: Thu, 17 Feb 2022 10:34:30 +0100 Subject: [PATCH] review: failsafe for sparkline points --- src/market/api/api.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/market/api/api.ts b/src/market/api/api.ts index ded5792e29..389f2913cf 100644 --- a/src/market/api/api.ts +++ b/src/market/api/api.ts @@ -52,6 +52,8 @@ const matchSearch = }; function distributedCopy(items: number[], n: number): number[] { + if (!items) return []; + if (items.length <= n) return items; const elements = [items[0]]; const totalItems = items.length - 2; const interval = Math.floor(totalItems / (n - 2));