Skip to content

Open source AI coding agent. Designed for large projects and real world tasks.

Protect against possible panic in onBuildFileError

Dane Schneider091db00c277b
diff --git a/app/server/model/plan/build_finish.go b/app/server/model/plan/build_finish.go
index ea50d859..fa948d16 100644
--- a/app/server/model/plan/build_finish.go
+++ b/app/server/model/plan/build_finish.go
@@ -303,10 +303,12 @@ func (fileState *activeBuildStreamFileState) onBuildFileError(err error) {
activeBuild.Success = false
activeBuild.Error = err
- activePlan.StreamDoneCh <- &shared.ApiError{
- Type: shared.ApiErrorTypeOther,
- Status: http.StatusInternalServerError,
- Msg: err.Error(),
+ if activePlan != nil {
+ activePlan.StreamDoneCh <- &shared.ApiError{
+ Type: shared.ApiErrorTypeOther,
+ Status: http.StatusInternalServerError,
+ Msg: err.Error(),
+ }
}
if err != nil {