on main help sign in
fix: handle code agent not initialized
d3f28ddKujtim Hoxha
internal/tui/page/chat/chat.go+4
@@ -300,6 +300,10 @@ func (p *chatPage) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
300 case tea.KeyPressMsg:
300 case tea.KeyPressMsg:
301 switch {
301 switch {
302 case key.Matches(msg, p.keyMap.NewSession):
302 case key.Matches(msg, p.keyMap.NewSession):
303+ // if we have no agent do nothing
304+ if p.app.CoderAgent == nil {
305+ return p, nil
306+ }
303 if p.app.CoderAgent.IsBusy() {
307 if p.app.CoderAgent.IsBusy() {
304 return p, util.ReportWarn("Agent is busy, please wait before starting a new session...")
308 return p, util.ReportWarn("Agent is busy, please wait before starting a new session...")
305 }
309 }
internal/tui/tui.go+1−1
@@ -393,7 +393,7 @@ func (a *appModel) handleKeyPressMsg(msg tea.KeyPressMsg) tea.Cmd {
393 )
393 )
394 return tea.Sequence(cmds...)
394 return tea.Sequence(cmds...)
395 case key.Matches(msg, a.keyMap.Suspend):
395 case key.Matches(msg, a.keyMap.Suspend):
396− if a.app.CoderAgent.IsBusy() {
396+ if a.app.CoderAgent != nil && a.app.CoderAgent.IsBusy() {
397 return util.ReportWarn("Agent is busy, please wait...")
397 return util.ReportWarn("Agent is busy, please wait...")
398 }
398 }
399 return tea.Suspend
399 return tea.Suspend