From 9b303537fad80661f32a46e8db54bbf34bf347bd Mon Sep 17 00:00:00 2001 From: ljx0517 <ljx0517@gmail.com> Date: Thu, 1 Feb 2024 17:33:07 +0800 Subject: [PATCH] 123 --- assets/elephant/scene/pengpeng.ts | 4 ++-- assets/elephant/scene/pg.ts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/assets/elephant/scene/pengpeng.ts b/assets/elephant/scene/pengpeng.ts index 60ec0a4..5e01a93 100644 --- a/assets/elephant/scene/pengpeng.ts +++ b/assets/elephant/scene/pengpeng.ts @@ -236,13 +236,13 @@ export default class PengPeng extends cc.Component { // dragonDisplay.dragonAtlasAsset.destroy(); // dragonDisplay.dragonAsset.destroy(); - if (u1 && u1.startsWith('http')) { + if (u1 && typeof u1 == 'string' && u1.startsWith('http')) { console.log('release1', u1) dragonDisplay.dragonAtlasAsset.destroy(); cc.assetManager.releaseAsset(dragonDisplay.dragonAtlasAsset.texture); cc.assetManager.releaseAsset(u1); } - if (u2 && u2.startsWith('http')) { + if (u2 && typeof u2 == 'string' && u2.startsWith('http')) { console.log('release1', u2) dragonDisplay.dragonAsset.destroy(); cc.assetManager.releaseAsset(u2); diff --git a/assets/elephant/scene/pg.ts b/assets/elephant/scene/pg.ts index 28abbba..2cb171d 100644 --- a/assets/elephant/scene/pg.ts +++ b/assets/elephant/scene/pg.ts @@ -322,7 +322,7 @@ let pg = { // if (err && !texture) return resolve(pg.logger.w('loading loadNetImg warn-> ' + texture)); // resolve(texture); // }); - if (url.startsWith('http')) { + if (url && typeof url == 'string' && url.startsWith('http')) { cc.assetManager.loadRemote(url, (err, texture) => { if (err && !texture) return resolve(pg.logger.w('loading loadNetImg warn-> ' + texture)); resolve(texture); @@ -347,7 +347,7 @@ let pg = { resolve(url); } if (!option || Object.keys(option).length == 0) option = {type: cc.Texture2D}; - if (url.startsWith('http')) { + if (url && typeof url == 'string' && url.startsWith('http')) { cc.assetManager.loadRemote(url,option, (err, texture) => { if (err && !texture) return reject(pg.logger.w('loading loadNetImg warn-> ' + texture)); resolve(texture); -- 2.21.0