From 669fe85e44ba945943799c5b4f46e7d128e4e0d3 Mon Sep 17 00:00:00 2001 From: Jerome Laban Date: Fri, 28 Jun 2024 09:18:51 -0400 Subject: [PATCH] fix: Skip empty version property --- src/NvGet/Extensions/XmlDocumentExtensions.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/NvGet/Extensions/XmlDocumentExtensions.cs b/src/NvGet/Extensions/XmlDocumentExtensions.cs index d122b02..fd0f6f9 100644 --- a/src/NvGet/Extensions/XmlDocumentExtensions.cs +++ b/src/NvGet/Extensions/XmlDocumentExtensions.cs @@ -111,9 +111,12 @@ public static PackageIdentity[] GetPackageReferences(this XmlDocument document) var packageName = string.Concat(nameParts).ToLowerInvariant(); - if(NuGetVersion.TryParse(versionProperty.InnerText, out var nugetVersion)) + if(!string.IsNullOrWhiteSpace(packageName)) { - references.Add(CreatePackageIdentity(packageName, versionProperty.InnerText)); + if(NuGetVersion.TryParse(versionProperty.InnerText, out var nugetVersion)) + { + references.Add(CreatePackageIdentity(packageName, versionProperty.InnerText)); + } } }