From 0a0e730d2582891448fa63632b92ace7a14cb2c9 Mon Sep 17 00:00:00 2001 From: vovaslotmill Date: Fri, 2 Feb 2024 20:41:14 +0100 Subject: [PATCH] fix: resolve faulty texture loading with null --- packages/loader-base/src/atlasLoader.ts | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/packages/loader-base/src/atlasLoader.ts b/packages/loader-base/src/atlasLoader.ts index 454cc3c1..78aae5ba 100644 --- a/packages/loader-base/src/atlasLoader.ts +++ b/packages/loader-base/src/atlasLoader.ts @@ -97,13 +97,17 @@ const spineTextureAtlasLoader: AssetExtension { return async (pageName: string, textureLoadedCallback: (tex: BaseTexture) => any): Promise => { - // const url = utils.path.join(...atlasBasePath.split(utils.path.sep), pageName); // Broken in upstream + try { + // const url = utils.path.join(...atlasBasePath.split(utils.path.sep), pageName); // Broken in upstream - const url = utils.path.normalize([...atlasBasePath.split(utils.path.sep), pageName].join(utils.path.sep)); + const url = utils.path.normalize([...atlasBasePath.split(utils.path.sep), pageName].join(utils.path.sep)); - const texture = await loader.load({ src: url, data: imageMetadata }); + const texture = await loader.load({ src: url, data: imageMetadata }); - textureLoadedCallback(texture.baseTexture); + textureLoadedCallback(texture.baseTexture); + } catch { + textureLoadedCallback(null); + } }; };