validate file part bounds to prevent panic (#1612)

This commit is contained in:
Omar Shaarawi
2025-08-05 05:18:50 -05:00
committed by GitHub
parent 51498c8de4
commit 58e889796c
2 changed files with 15 additions and 5 deletions

View File

@@ -303,7 +303,9 @@ func (m *messagesComponent) renderView() tea.Cmd {
for _, part := range remainingParts {
switch part := part.(type) {
case opencode.FilePart:
fileParts = append(fileParts, part)
if part.Source.Text.Start >= 0 && part.Source.Text.End >= part.Source.Text.Start {
fileParts = append(fileParts, part)
}
}
}
flexItems := []layout.FlexItem{}