chore: fix panic on message send

Kujtim Hoxha created

Change summary

internal/tui/components/chat/editor/editor.go | 3 +++
1 file changed, 3 insertions(+)

Detailed changes

internal/tui/components/chat/editor/editor.go 🔗

@@ -130,6 +130,9 @@ func (m *editorCmp) Init() tea.Cmd {
 }
 
 func (m *editorCmp) send() tea.Cmd {
+	if m.app.CoderAgent == nil {
+		return util.ReportError(fmt.Errorf("coder agent is not initialized"))
+	}
 	if m.app.CoderAgent.IsSessionBusy(m.session.ID) {
 		return util.ReportWarn("Agent is working, please wait...")
 	}