C#: Fix null exception in our MSBuild logger
This commit is contained in:
parent
4f96c65e13
commit
7eed8c5a0c
|
@ -70,13 +70,14 @@ namespace GodotTools.BuildLogger
|
||||||
{
|
{
|
||||||
string line = $"{e.File}({e.LineNumber},{e.ColumnNumber}): error {e.Code}: {e.Message}";
|
string line = $"{e.File}({e.LineNumber},{e.ColumnNumber}): error {e.Code}: {e.Message}";
|
||||||
|
|
||||||
if (e.ProjectFile.Length > 0)
|
if (!string.IsNullOrEmpty(e.ProjectFile))
|
||||||
line += $" [{e.ProjectFile}]";
|
line += $" [{e.ProjectFile}]";
|
||||||
|
|
||||||
WriteLine(line);
|
WriteLine(line);
|
||||||
|
|
||||||
string errorLine = $@"error,{e.File.CsvEscape()},{e.LineNumber},{e.ColumnNumber}," +
|
string errorLine = $@"error,{e.File.CsvEscape()},{e.LineNumber},{e.ColumnNumber}," +
|
||||||
$@"{e.Code.CsvEscape()},{e.Message.CsvEscape()},{e.ProjectFile.CsvEscape()}";
|
$"{e.Code?.CsvEscape() ?? string.Empty},{e.Message.CsvEscape()}," +
|
||||||
|
$"{e.ProjectFile?.CsvEscape() ?? string.Empty}";
|
||||||
issuesStreamWriter.WriteLine(errorLine);
|
issuesStreamWriter.WriteLine(errorLine);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -89,8 +90,9 @@ namespace GodotTools.BuildLogger
|
||||||
|
|
||||||
WriteLine(line);
|
WriteLine(line);
|
||||||
|
|
||||||
string warningLine = $@"warning,{e.File.CsvEscape()},{e.LineNumber},{e.ColumnNumber},{e.Code.CsvEscape()}," +
|
string warningLine = $@"warning,{e.File.CsvEscape()},{e.LineNumber},{e.ColumnNumber}," +
|
||||||
$@"{e.Message.CsvEscape()},{(e.ProjectFile != null ? e.ProjectFile.CsvEscape() : string.Empty)}";
|
$"{e.Code?.CsvEscape() ?? string.Empty},{e.Message.CsvEscape()}," +
|
||||||
|
$"{e.ProjectFile?.CsvEscape() ?? string.Empty}";
|
||||||
issuesStreamWriter.WriteLine(warningLine);
|
issuesStreamWriter.WriteLine(warningLine);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue