diff --git a/apps/ai-game-creator-shell/src/view/ui-editor/components/Inspector/Components/ImageAssetSelector.tsx b/apps/ai-game-creator-shell/src/view/ui-editor/components/Inspector/Components/ImageAssetSelector.tsx index 42c15c56f..e4c0d0419 100644 --- a/apps/ai-game-creator-shell/src/view/ui-editor/components/Inspector/Components/ImageAssetSelector.tsx +++ b/apps/ai-game-creator-shell/src/view/ui-editor/components/Inspector/Components/ImageAssetSelector.tsx @@ -22,11 +22,12 @@ export function ImageAssetSelector({ Record >({}); const selectedSprite = value ? sprites[value] : undefined; - const selectedLabel = selectedSprite - ? selectedSprite.metadata.name || value || '未绑定' - : value - ? `素材不存在(${value})` - : '未绑定'; + let selectedLabel = '未绑定'; + if (selectedSprite) { + selectedLabel = selectedSprite.metadata.name || value || '未绑定'; + } else if (value) { + selectedLabel = `素材不存在(${value})`; + } const buttonLabel = value ? '更换素材' : '选择素材'; function close() {