Move code intended to handle bad .ani files to the right place

This commit is contained in:
Jordan Eldredge 2021-01-05 22:45:47 -08:00
parent ba7c12d6d7
commit 8c4d8894ec
2 changed files with 9 additions and 8 deletions

View file

@ -93,10 +93,16 @@ const getCssRules = createSelector(
case "cur":
return `${selector} {cursor: url(${cursor.url}), auto}`;
case "ani": {
return convertAniBinaryToCSS(selector, cursor.aniData);
try {
return convertAniBinaryToCSS(selector, cursor.aniData);
} catch (e) {
console.error(e);
return null;
}
}
}
});
})
.filter(Boolean);
cssRules.push(...cursorRules);
});

View file

@ -145,12 +145,7 @@ export async function getCursorFromFilename(
}
const contents = file.contents as Uint8Array;
if (arrayStartsWith(contents, RIFF_MAGIC)) {
try {
return { type: "ani", aniData: contents };
} catch (e) {
console.error(e);
return null;
}
return { type: "ani", aniData: contents };
}
return { type: "cur", url: FileUtils.curUrlFromByteArray(contents) };