From 52c3f207625b8add9b3df12932dea4019fe6d67d Mon Sep 17 00:00:00 2001 From: James Cor Date: Fri, 3 Jan 2025 16:50:30 -0800 Subject: [PATCH] fix --- go/cmd/dolt/commands/diff.go | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/go/cmd/dolt/commands/diff.go b/go/cmd/dolt/commands/diff.go index 768962f041..e2b63bd841 100644 --- a/go/cmd/dolt/commands/diff.go +++ b/go/cmd/dolt/commands/diff.go @@ -1675,13 +1675,21 @@ func writeDiffResults( for i, changeType := range newRow.ColDiffs { if (changeType == diff.Added|diff.Removed) || modifiedColNames[targetSch[i].Name] { if oldRow.Row != nil && i < oldRow.Row.Len() { - filteredOldRow.Row = filteredOldRow.Row.Append(oldRow.Row.Subslice(i, i+1)) + if filteredOldRow.Row == nil { + filteredOldRow.Row = oldRow.Row.Subslice(i, i+1) + } else { + filteredOldRow.Row = filteredOldRow.Row.Append(oldRow.Row.Subslice(i, i+1)) + } filteredOldRow.ColDiffs = append(filteredOldRow.ColDiffs, oldRow.ColDiffs[i]) filteredOldRow.RowDiff = oldRow.RowDiff } if newRow.Row != nil && i < newRow.Row.Len() { - filteredNewRow.Row = filteredNewRow.Row.Append(newRow.Row.Subslice(i, i+1)) + if filteredNewRow.Row == nil { + filteredNewRow.Row = newRow.Row.Subslice(i, i+1) + } else { + filteredNewRow.Row = filteredNewRow.Row.Append(newRow.Row.Subslice(i, i+1)) + } filteredNewRow.ColDiffs = append(filteredNewRow.ColDiffs, newRow.ColDiffs[i]) filteredNewRow.RowDiff = newRow.RowDiff }