Fix all optional comments references - add null checks everywhere

This commit is contained in:
OpenClaw Bot 2026-02-19 20:22:32 -06:00
parent c0ca8721e8
commit 118078fc75
2 changed files with 4 additions and 4 deletions

View File

@ -386,7 +386,7 @@ export default function Home() {
<span className={priorityColors[task.priority]}>
{task.priority}
</span>
{task.comments.length > 0 && (
{task.comments && task.comments.length > 0 && (
<span className="flex items-center gap-1 text-slate-500">
<MessageSquare className="w-3 h-3" />
{task.comments.length}
@ -633,12 +633,12 @@ export default function Home() {
<div className="border-t border-slate-800 pt-6">
<h4 className="font-medium text-white mb-4 flex items-center gap-2">
<MessageSquare className="w-4 h-4" />
Notes & Comments ({editedTask.comments.length})
Notes & Comments ({editedTask.comments?.length || 0})
</h4>
{/* Comment List */}
<div className="space-y-4 mb-4">
{editedTask.comments.length === 0 ? (
{!editedTask.comments || editedTask.comments.length === 0 ? (
<p className="text-slate-500 text-sm">No notes yet. Add the first one!</p>
) : (
editedTask.comments.map((comment) => (

View File

@ -101,7 +101,7 @@ function SortableTaskCard({
<Badge variant="outline" className="text-xs border-slate-600 text-slate-400">
{task.type}
</Badge>
{task.comments.length > 0 && (
{task.comments && task.comments.length > 0 && (
<span className="text-xs text-slate-500">
💬 {task.comments.length}
</span>