Skip to content

Commit a75de28

Browse files
Merge pull request #14 from x15sr71/fix/server-comparer-empty-path-guard
[FIX]: Guard against empty output file path in ServerComparer
2 parents add47b6 + f84e593 commit a75de28

1 file changed

Lines changed: 12 additions & 1 deletion

File tree

‎CCExtractorTester/Comparers/ServerComparer.cs‎

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,17 @@ public void CompareAndAddToResult(CompareData data)
102102
// Check for equality by hash
103103
if (!data.Dummy && !Hasher.filesAreEqual(data.CorrectFile, data.ProducedFile))
104104
{
105+
// Guard: if no output file was produced, skip upload.
106+
// When ProducedFile is empty (output missing), File.Open("") throws
107+
// ArgumentException which is swallowed by the caller's catch-all
108+
// handler, resulting in no TestResultFile row being written.
109+
// This prevents the ArgumentException from propagating to the
110+
// caller's catch block.
111+
if (string.IsNullOrEmpty(data.ProducedFile) || !File.Exists(data.ProducedFile))
112+
{
113+
return;
114+
}
115+
105116
// Upload result
106117
using (FileStream stream = File.Open(data.ProducedFile, FileMode.Open))
107118
{
@@ -189,4 +200,4 @@ public void SendExitCodeAndRuntime(RunData rd, int testId)
189200
}
190201
}
191202
}
192-
}
203+
}

0 commit comments

Comments
 (0)