misc.color: oops oom

This commit is contained in:
Cynthia Foxwell 2024-07-31 21:41:30 -06:00
parent 3d7b918130
commit 1bef3d11a9

View file

@ -638,7 +638,6 @@ const colornamesMapped = colornamesRaw.map((line) => {
return [hex, name]; return [hex, name];
}); });
const colornames = Object.fromEntries(colornamesMapped); const colornames = Object.fromEntries(colornamesMapped);
const colornamesFlipped = Object.fromEntries(colornamesMapped.reverse());
const color = new Command("color"); const color = new Command("color");
color.category = CATEGORY; color.category = CATEGORY;
@ -653,7 +652,7 @@ color.callback = async function (msg, line, args, {truerandom}) {
} }
if (!color.isValid) { if (!color.isValid) {
const colornamesHex = colornamesFlipped[line]; const colornamesHex = Object.entries(colornames).find(([hex, name]) => name.toLowerCase().localeCompare(line))[0];
if (colornamesHex) { if (colornamesHex) {
color = tinycolor(colornamesHex); color = tinycolor(colornamesHex);
} else { } else {