fix(tui): panic (#1220)

Carlos Alexandro Becker created

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>

Change summary

internal/tui/tui.go | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

Detailed changes

internal/tui/tui.go 🔗

@@ -603,9 +603,9 @@ func (a *appModel) View() tea.View {
 	view.Layer = canvas
 	view.Cursor = cursor
 	view.ProgressBar = tea.NewProgressBar(tea.ProgressBarNone, 0)
-	if a.app.CoderAgent.IsBusy() {
-		// use a random percentage to prevent the ghostty from hiding it after
-		// a timeout.
+	if a.app != nil && a.app.CoderAgent != nil && a.app.CoderAgent.IsBusy() {
+		// HACK: use a random percentage to prevent ghostty from hiding it
+		// after a timeout.
 		view.ProgressBar = tea.NewProgressBar(tea.ProgressBarIndeterminate, rand.Intn(100))
 	}
 	return view