Skip to content

Commit e179733

Browse files
Fix textureCache
1 parent c0f6318 commit e179733

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/model.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -285,9 +285,12 @@ class ModelManager {
285285
const version = this.checkModelVersion(modelSetting);
286286
if (version === 2) {
287287
const textureCache = await this.loadTextureCache(modelName);
288-
let textures = textureCache[this.modelTexturesId];
289-
if (typeof textures === 'string') textures = [textures];
290-
modelSetting.textures = textures;
288+
// this.loadTextureCache may return an empty array
289+
if (textureCache.length > 0) {
290+
let textures = textureCache[this.modelTexturesId];
291+
if (typeof textures === 'string') textures = [textures];
292+
modelSetting.textures = textures;
293+
}
291294
}
292295
} else {
293296
modelSettingPath = this.models[this.modelId].paths[this.modelTexturesId];

0 commit comments

Comments
 (0)