From f84e5936307db5fee8f468d090268dc5ce176dc3 Mon Sep 17 00:00:00 2001 From: Chandragupt Singh Date: Sun, 7 Jun 2026 17:42:59 +0530 Subject: [PATCH] fix: guard against empty ProducedFile path in ServerComparer to prevent silent comparison failure --- CCExtractorTester/Comparers/ServerComparer.cs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/CCExtractorTester/Comparers/ServerComparer.cs b/CCExtractorTester/Comparers/ServerComparer.cs index 8c07203..cb9a14c 100644 --- a/CCExtractorTester/Comparers/ServerComparer.cs +++ b/CCExtractorTester/Comparers/ServerComparer.cs @@ -102,6 +102,17 @@ public void CompareAndAddToResult(CompareData data) // Check for equality by hash if (!data.Dummy && !Hasher.filesAreEqual(data.CorrectFile, data.ProducedFile)) { + // Guard: if no output file was produced, skip upload. + // When ProducedFile is empty (output missing), File.Open("") throws + // ArgumentException which is swallowed by the caller's catch-all + // handler, resulting in no TestResultFile row being written. + // This prevents the ArgumentException from propagating to the + // caller's catch block. + if (string.IsNullOrEmpty(data.ProducedFile) || !File.Exists(data.ProducedFile)) + { + return; + } + // Upload result using (FileStream stream = File.Open(data.ProducedFile, FileMode.Open)) { @@ -189,4 +200,4 @@ public void SendExitCodeAndRuntime(RunData rd, int testId) } } } -} +} \ No newline at end of file