misc.woflram: don't fail if can't grab image

This commit is contained in:
Cynthia Foxwell 2022-06-22 10:53:43 -06:00
parent cfa87eb297
commit 76ee7a789b
1 changed files with 9 additions and 3 deletions

View File

@ -124,9 +124,15 @@ wolfram.callback = async function (msg, line) {
let image;
if (data[1].subpods[0].img.src)
image = Buffer.from(
await fetch(data[1].subpods[0].img.src).then((x) => x.arrayBuffer())
);
try {
const res = await fetch(data[1].subpods[0].img.src);
if (res) {
const imgData = await res.arrayBuffer();
image = Buffer.from(imgData);
}
} catch {
//
}
let string = "";
if (data[1].subpods[0].plaintext.length > 0)