From 9fd54e7d68085a1a9c71c0b6a4fdffc041dd4fd1 Mon Sep 17 00:00:00 2001 From: Matt Toohey Date: Thu, 11 Jul 2024 14:56:13 +1000 Subject: [PATCH] fix: if a call has an error it should not access resp field --- backend/controller/controller.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/backend/controller/controller.go b/backend/controller/controller.go index db3d5bf5a1..5f249672cd 100644 --- a/backend/controller/controller.go +++ b/backend/controller/controller.go @@ -1000,9 +1000,10 @@ func (s *Service) callWithRequest( headers.AddCaller(req.Header(), schema.RefFromProto(req.Msg.Verb)) response, err := client.verb.Call(ctx, req) - resp := connect.NewResponse(response.Msg) + var resp *connect.Response[ftlv1.CallResponse] var maybeResponse optional.Option[*ftlv1.CallResponse] - if resp != nil { + if err == nil { + resp = connect.NewResponse(response.Msg) maybeResponse = optional.Some(resp.Msg) } s.recordCall(ctx, &Call{