diff --git a/apps/desktop/src/components/MaterialSegmentView.tsx b/apps/desktop/src/components/MaterialSegmentView.tsx index f32adc2..f356a52 100644 --- a/apps/desktop/src/components/MaterialSegmentView.tsx +++ b/apps/desktop/src/components/MaterialSegmentView.tsx @@ -219,34 +219,40 @@ export const MaterialSegmentView: React.FC = ({ projec }, [segmentView, activeTab, selectedClassification, selectedModel, searchTerm]); // 渲染片段卡片 - const renderSegmentCard = (segment: SegmentWithDetails) => ( -
-
- {/* 缩略图 */} -
- {segment.material_info.thumbnail_path ? ( - 缩略图 - ) : ( -
+ const renderSegmentCard = (segment: SegmentWithDetails) => { + // 安全检查 + if (!segment || !segment.segment || !segment.material_info) { + return null; + } - {/* 内容信息 */} -
-
-
-

- {segment.material_info.name} -

-

- {formatDuration(segment.segment.start_time)} - {formatDuration(segment.segment.end_time)} - 时长: {formatDuration(segment.segment.duration)} -

-
+ return ( +
+
+ {/* 缩略图 */} +
+ {segment.material_info?.thumbnail_path ? ( + 缩略图 + ) : ( +
+ + {/* 内容信息 */} +
+
+
+

+ {segment.material_info?.name || '未知素材'} +

+

+ {formatDuration(segment.segment.start_time)} - {formatDuration(segment.segment.end_time)} + 时长: {formatDuration(segment.segment.duration)} +

+
{/* 操作按钮 */}
@@ -287,7 +293,8 @@ export const MaterialSegmentView: React.FC = ({ projec
- ); + ); + }; if (loading) { return (