Skip to content

Commit

Permalink
[Fix] null reference exception when processing version of PackageRefe…
Browse files Browse the repository at this point in the history
…rences
  • Loading branch information
samatstariongroup committed Feb 27, 2023
1 parent 0d79406 commit f1b4b1a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<PackageId>nppe</PackageId>
<ToolCommandName>nppe</ToolCommandName>
<PackageOutputPath>./nupkg</PackageOutputPath>
<Version>1.0.0</Version>
<Version>1.0.1</Version>
<ImplicitUsings>disable</ImplicitUsings>
</PropertyGroup>

Expand Down
11 changes: 5 additions & 6 deletions NetProjectPackageExtractor/Services/ProjectFileParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -89,20 +89,19 @@ private static IEnumerable<Package> ParseProjectFile(FileInfo projectFile)
{
projectVersion = versionElement.InnerText;
}



var packageReferenceElements = document.GetElementsByTagName("PackageReference");

foreach (var element in packageReferenceElements)
{
var xmlElement = (XmlNode)element;

var package = new Package
var package = new Package
{
ProjectTitle = projectTitle,
ProjectVersion = projectVersion,
Name = xmlElement.Attributes["Include"].Value,
Version = xmlElement.Attributes["Version"].Value,
Name = xmlElement.Attributes["Include"]?.Value,
Version = xmlElement.Attributes["Version"]?.Value,
};

yield return package;
Expand Down

0 comments on commit f1b4b1a

Please sign in to comment.