From 2ae6905199c0508ebb07f855b30c9932d6831ed4 Mon Sep 17 00:00:00 2001 From: AZhan Date: Mon, 15 Jul 2024 19:59:03 +0800 Subject: [PATCH] Fix sprite atlas loader bug (#2164) --- packages/loader/src/SpriteAtlasLoader.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/loader/src/SpriteAtlasLoader.ts b/packages/loader/src/SpriteAtlasLoader.ts index 7359fbd25f..270773143b 100644 --- a/packages/loader/src/SpriteAtlasLoader.ts +++ b/packages/loader/src/SpriteAtlasLoader.ts @@ -38,12 +38,12 @@ class SpriteAtlasLoader extends Loader { const atlasItemsLen = atlasItems ? atlasItems.length : 0; const { engine } = resourceManager; const spriteAtlas = new SpriteAtlas(engine); - if (atlasItemsLen < 0) { + if (atlasItemsLen <= 0) { resolve(spriteAtlas); return; } chainPromises.length = 0; - for (let i = 0; i < atlasItems.length; i++) { + for (let i = 0; i < atlasItemsLen; i++) { const atlasItem = atlasItems[i]; if (atlasItem.img) { chainPromises.push(