From 9c6499ec08cfcc390a545e4c67c4c65252a454b5 Mon Sep 17 00:00:00 2001 From: Jason Song Date: Thu, 6 Apr 2023 21:51:46 +0800 Subject: [PATCH] Fix panic when response is nil (#105) Reviewed-on: https://gitea.com/gitea/act_runner/pulls/105 Reviewed-by: Lunny Xiao Co-authored-by: Jason Song Co-committed-by: Jason Song --- internal/app/poll/poller.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/app/poll/poller.go b/internal/app/poll/poller.go index c201eff..913e464 100644 --- a/internal/app/poll/poller.go +++ b/internal/app/poll/poller.go @@ -74,7 +74,7 @@ func (p *Poller) fetchTask(ctx context.Context) (*runnerv1.Task, bool) { return nil, false } - if resp.Msg.Task == nil { + if resp == nil || resp.Msg == nil || resp.Msg.Task == nil { return nil, false } return resp.Msg.Task, true