Adding error case when texture is empty

This commit is contained in:
David Négrier
2022-03-14 14:28:42 +01:00
parent 52b5027702
commit b6b6c7f15f
2 changed files with 7 additions and 1 deletions
@@ -96,6 +96,12 @@ export const createLoadingPromise = (
return;
});
// If for some reason, the "img" is empty, let's reject the promise.
if (!playerResourceDescriptor.img) {
console.warn("Tried to load an empty texture for a Woka");
rej(playerResourceDescriptor);
return;
}
loadPlugin.spritesheet(playerResourceDescriptor.id, playerResourceDescriptor.img, frameConfig);
const errorCallback = (file: { src: string }) => {
if (file.src !== playerResourceDescriptor.img) return;