From e22d68249b0e2d38a4c09b44bce69936624fb614 Mon Sep 17 00:00:00 2001
From: Bill Horsman <bill@logicalcobwebs.com>
Date: Tue, 13 Dec 2022 15:30:06 +0000
Subject: [PATCH] Cope with a nil uploader

which can happen if the gem is loaded but hasn't been configured. This has been a problem since 2eb068dda0a7cf00fdaa644d3204462b5588f2ad
---
 lib/buildkite/test_collector/minitest_plugin/reporter.rb | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/lib/buildkite/test_collector/minitest_plugin/reporter.rb b/lib/buildkite/test_collector/minitest_plugin/reporter.rb
index 49463ad..e6ac263 100644
--- a/lib/buildkite/test_collector/minitest_plugin/reporter.rb
+++ b/lib/buildkite/test_collector/minitest_plugin/reporter.rb
@@ -11,8 +11,10 @@ def initialize(io, options)
     def record(result)
       super
 
-      if trace = Buildkite::TestCollector.uploader.traces[result.source_location]
-        Buildkite::TestCollector.session&.write_result(trace)
+      if Buildkite::TestCollector.uploader
+        if trace = Buildkite::TestCollector.uploader.traces[result.source_location]
+          Buildkite::TestCollector.session&.write_result(trace)
+        end
       end
     end