« get me outta code hell

data: chunkMultipleArrays: fix zero-items case - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2024-01-11 13:03:10 -0400
committer(quasar) nebula <qznebula@protonmail.com>2024-01-11 13:03:10 -0400
commit867c00a1a9d01745bb9f13b4dc69b750a34293cd (patch)
tree7c6aba6818792bc972bae8ba321caa37d90dba7c
parentfb94c24043b9f7db8f5e9a9c0c64faaf95cc88ed (diff)
data: chunkMultipleArrays: fix zero-items case
-rw-r--r--src/util/wiki-data.js4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/util/wiki-data.js b/src/util/wiki-data.js
index b5813c7a..1c1db6c1 100644
--- a/src/util/wiki-data.js
+++ b/src/util/wiki-data.js
@@ -71,6 +71,10 @@ export function chunkMultipleArrays(...args) {
   const arrays = args.slice(0, -1);
   const fn = args.at(-1);
 
+  if (arrays[0].length === 0) {
+    return [];
+  }
+
   const newChunk = index => arrays.map(array => [array[index]]);
   const results = [newChunk(0)];