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

View File

@ -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;

View File

@ -18,7 +18,7 @@ import { soundManager } from "./SoundManager";
import { SharedVariablesManager } from "./SharedVariablesManager";
import { EmbeddedWebsiteManager } from "./EmbeddedWebsiteManager";
import { lazyLoadPlayerCharacterTextures, loadWokaTexture } from "../Entity/PlayerTexturesLoadingManager";
import { lazyLoadPlayerCharacterTextures } from "../Entity/PlayerTexturesLoadingManager";
import { lazyLoadCompanionResource } from "../Companion/CompanionTexturesLoadingManager";
import { iframeListener } from "../../Api/IframeListener";
import { DEBUG_MODE, JITSI_URL, MAX_PER_GROUP, POSITION_DELAY } from "../../Enum/EnvironmentVariable";