Skip to content

Commit

Permalink
Avoid using string.Format with null args
Browse files Browse the repository at this point in the history
  • Loading branch information
simonrozsival authored and PureWeen committed Oct 18, 2024
1 parent 79db39b commit 5ce0498
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/Controls/src/Build.Tasks/BuildException.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,12 @@ protected BuildException(System.Runtime.Serialization.SerializationInfo info, Sy

static string FormatMessage(BuildExceptionCode code, IXmlLineInfo xmlinfo, object[] args)
{
var message = string.Format(ErrorMessages.ResourceManager.GetString(code.ErrorMessageKey), args);
var message = ErrorMessages.ResourceManager.GetString(code.ErrorMessageKey);
if (args is not null)
{
message = string.Format(message, args);
}

var ecode = code.Code;
var position = xmlinfo == null || !xmlinfo.HasLineInfo() ? "" : $"({xmlinfo.LineNumber},{xmlinfo.LinePosition})";

Expand Down

0 comments on commit 5ce0498

Please sign in to comment.