From 06897e0e43590e3b991bd37a43176b17f003e903 Mon Sep 17 00:00:00 2001 From: Mashy Date: Fri, 18 Oct 2019 09:37:58 +1000 Subject: [PATCH] safety in case null combo (shouldn't happen anyway) --- client/src/components/vbox.component.jsx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/client/src/components/vbox.component.jsx b/client/src/components/vbox.component.jsx index c2e03207..9377795c 100644 --- a/client/src/components/vbox.component.jsx +++ b/client/src/components/vbox.component.jsx @@ -332,7 +332,7 @@ function Vbox(args) { function combinerBtn() { let text = ''; - let comboItem = 'refine'; + let comboItem = ''; if (combiner.length < 3) { for (let i = 0; i < 3; i++) { if (combiner.length > i) { @@ -342,9 +342,10 @@ function Vbox(args) { } } } else { - // Since theres 3 items in combiner and you can't have valid combos we can preview it + // Since theres 3 items in combiner and you can't have invalid combos we can preview it const combinerItems = combiner.map(j => vbox.bound[j]); - comboItem = itemInfo.combos.find(combo => combinerItems.every(c => combo.components.includes(c))).item; + const comboItemObj = itemInfo.combos.find(combo => combinerItems.every(c => combo.components.includes(c))); + comboItem = comboItemObj ? comboItemObj.item : 'refine'; text = `Combine - ${comboItem}`; }