fix: address potential panic on initialization (#2092)

Andrey Nering created

Easily reproducible for a new setup (onboarding).

Change summary

internal/app/lsp.go | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)

Detailed changes

internal/app/lsp.go 🔗

@@ -76,8 +76,10 @@ func (app *App) initLSPClients(ctx context.Context) {
 	}
 	wg.Wait()
 
-	if err := app.AgentCoordinator.UpdateModels(ctx); err != nil {
-		slog.Error("Failed to refresh tools after LSP startup", "error", err)
+	if app.AgentCoordinator != nil {
+		if err := app.AgentCoordinator.UpdateModels(ctx); err != nil {
+			slog.Error("Failed to refresh tools after LSP startup", "error", err)
+		}
 	}
 }