safety in case null combo (shouldn't happen anyway)

This commit is contained in:
Mashy 2019-10-18 09:37:58 +10:00
parent 85497bfbf2
commit 06897e0e43

View File

@ -332,7 +332,7 @@ function Vbox(args) {
function combinerBtn() { function combinerBtn() {
let text = ''; let text = '';
let comboItem = 'refine'; let comboItem = '';
if (combiner.length < 3) { if (combiner.length < 3) {
for (let i = 0; i < 3; i++) { for (let i = 0; i < 3; i++) {
if (combiner.length > i) { if (combiner.length > i) {
@ -342,9 +342,10 @@ function Vbox(args) {
} }
} }
} else { } 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]); 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}`; text = `Combine - ${comboItem}`;
} }