Skip to content

Commit ae0e6c1

Browse files
fix: add nil check for autocomplete in issueview.UpdateProgramContext
When issueview.Model is not properly initialized (e.g., in tests that create partial models), the ac pointer is nil. This caused a panic when syncProgramContext called UpdateProgramContext on all components.
1 parent c0c2605 commit ae0e6c1

File tree

3 files changed

+8
-7
lines changed

3 files changed

+8
-7
lines changed

internal/tui/components/issueview/issueview.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -554,5 +554,7 @@ func (m *Model) issueAssignees() []string {
554554
func (m *Model) UpdateProgramContext(ctx *context.ProgramContext) {
555555
m.ctx = ctx
556556
m.inputBox.UpdateProgramContext(ctx)
557-
m.ac.UpdateProgramContext(ctx)
557+
if m.ac != nil {
558+
m.ac.UpdateProgramContext(ctx)
559+
}
558560
}

internal/tui/components/tasks/issue_test.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@ type mockIssue struct {
2222
updatedAt time.Time
2323
}
2424

25-
func (m mockIssue) GetNumber() int { return m.number }
26-
func (m mockIssue) GetRepoNameWithOwner() string { return m.repoName }
27-
func (m mockIssue) GetTitle() string { return m.title }
28-
func (m mockIssue) GetUrl() string { return m.url }
29-
func (m mockIssue) GetUpdatedAt() time.Time { return m.updatedAt }
25+
func (m mockIssue) GetNumber() int { return m.number }
26+
func (m mockIssue) GetRepoNameWithOwner() string { return m.repoName }
27+
func (m mockIssue) GetTitle() string { return m.title }
28+
func (m mockIssue) GetUrl() string { return m.url }
29+
func (m mockIssue) GetUpdatedAt() time.Time { return m.updatedAt }
3030

3131
// noopStartTask is a stub that returns nil for testing
3232
func noopStartTask(task context.Task) tea.Cmd {

internal/tui/ui.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1633,4 +1633,3 @@ func (m *Model) executeNotificationAction(action string) tea.Cmd {
16331633

16341634
return nil
16351635
}
1636-

0 commit comments

Comments
 (0)