From d61b92125ec0529a28b42ce8e252ef18f2d52125 Mon Sep 17 00:00:00 2001 From: Santos Gallegos Date: Mon, 14 Jun 2021 19:53:23 -0500 Subject: [PATCH] Builds: check for nonexistent object (#8261) --- readthedocs/builds/tasks.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/readthedocs/builds/tasks.py b/readthedocs/builds/tasks.py index 7d03e65c330..958931cb725 100644 --- a/readthedocs/builds/tasks.py +++ b/readthedocs/builds/tasks.py @@ -361,7 +361,10 @@ def send_build_status(build_pk, commit, status, link_to_build=False): :param status: build status failed, pending, or success to be sent. """ # TODO: Send build status for BitBucket. - build = Build.objects.get(pk=build_pk) + build = Build.objects.filter(pk=build_pk).first() + if not build: + return + provider_name = build.project.git_provider_name log.info('Sending build status. build=%s, project=%s', build.pk, build.project.slug)