From d0cc9f8cddbc99492eedc1432b1396fb012ae283 Mon Sep 17 00:00:00 2001 From: kwaroran Date: Tue, 28 May 2024 22:56:38 +0900 Subject: [PATCH] refactor: Add checking in createBaseV3 function --- src/ts/characterCards.ts | 42 ++++++++++++++++++++++------------------ 1 file changed, 23 insertions(+), 19 deletions(-) diff --git a/src/ts/characterCards.ts b/src/ts/characterCards.ts index 085d8adf..f74223be 100644 --- a/src/ts/characterCards.ts +++ b/src/ts/characterCards.ts @@ -848,31 +848,35 @@ export function createBaseV3(char:character){ ext: string }> = structuredClone(char.ccAssets ?? []) - for(const asset of char.additionalAssets){ - assets.push({ - type: 'x-risu-asset', - uri: asset[1], - name: asset[0], - ext: asset[2] || 'unknown' - }) + if(char.additionalAssets){ + for(const asset of char.additionalAssets){ + assets.push({ + type: 'x-risu-asset', + uri: asset[1], + name: asset[0], + ext: asset[2] || 'unknown' + }) + } } - for(const asset of char.emotionImages){ + if(char.emotionImages){ + for(const asset of char.emotionImages){ + assets.push({ + type: 'emotion', + uri: asset[1], + name: asset[0], + ext: 'unknown' + }) + } + assets.push({ - type: 'emotion', - uri: asset[1], - name: asset[0], - ext: 'unknown' + type: 'icon', + uri: 'ccdefault:', + name: 'main', + ext: 'png' }) } - assets.push({ - type: 'icon', - uri: 'ccdefault:', - name: 'main', - ext: 'png' - }) - for(const lore of char.globalLore){ let ext:{ risu_case_sensitive?: boolean;