From 5b4740fa10535404041da365a5afc32186f54ef1 Mon Sep 17 00:00:00 2001 From: David Federman Date: Mon, 28 Oct 2024 07:38:32 -0700 Subject: [PATCH] Fix nullref in GetCopyToPublishDirectoryItemsGraphPredictor --- ...opyToPublishDirectoryItemsGraphPredictor.cs | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/BuildPrediction/Predictors/GetCopyToPublishDirectoryItemsGraphPredictor.cs b/src/BuildPrediction/Predictors/GetCopyToPublishDirectoryItemsGraphPredictor.cs index dfc6229..a3b390d 100644 --- a/src/BuildPrediction/Predictors/GetCopyToPublishDirectoryItemsGraphPredictor.cs +++ b/src/BuildPrediction/Predictors/GetCopyToPublishDirectoryItemsGraphPredictor.cs @@ -92,7 +92,11 @@ private static void ReportCopyToPublishDirectoryItems( if (!string.IsNullOrEmpty(projectDepsFilePath)) { predictionReporter.ReportInputFile(projectDepsFilePath); - predictionReporter.ReportOutputFile(Path.Combine(publishDir, Path.GetFileName(projectDepsFilePath))); + + if (!string.IsNullOrEmpty(publishDir)) + { + predictionReporter.ReportOutputFile(Path.Combine(publishDir, Path.GetFileName(projectDepsFilePath))); + } } } else @@ -101,7 +105,11 @@ private static void ReportCopyToPublishDirectoryItems( if (!string.IsNullOrEmpty(publishDepsFilePath)) { predictionReporter.ReportInputFile(publishDepsFilePath); - predictionReporter.ReportOutputFile(Path.Combine(publishDir, Path.GetFileName(publishDepsFilePath))); + + if (!string.IsNullOrEmpty(publishDir)) + { + predictionReporter.ReportOutputFile(Path.Combine(publishDir, Path.GetFileName(publishDepsFilePath))); + } } } } @@ -112,7 +120,11 @@ private static void ReportCopyToPublishDirectoryItems( if (!string.IsNullOrEmpty(projectRuntimeConfigFilePath)) { predictionReporter.ReportInputFile(projectRuntimeConfigFilePath); - predictionReporter.ReportOutputFile(Path.Combine(publishDir, Path.GetFileName(projectRuntimeConfigFilePath))); + + if (!string.IsNullOrEmpty(publishDir)) + { + predictionReporter.ReportOutputFile(Path.Combine(publishDir, Path.GetFileName(projectRuntimeConfigFilePath))); + } } } }