Permalink
Browse files

fix NRE in RequiredDependencyPackageCurator

  • Loading branch information...
1 parent 02b35c0 commit 1758184f5b7c0aca83a285832d56f55235e6f738 @derigel23 derigel23 committed Jun 30, 2016
Showing with 5 additions and 2 deletions.
  1. +5 −2 src/NuGetGallery/PackageCurators/RequiredDependencyPackageCurator.cs
@@ -35,7 +35,7 @@ public override void Curate(Package galleryPackage, INupkg nugetPackage, bool co
var feedDependencies = (from d in galleryPackage.Dependencies
from cf in curatedFeeds
- where d.Id.Equals(cf.Id, StringComparison.OrdinalIgnoreCase)
+ where string.Equals(d.Id, cf.Id, StringComparison.OrdinalIgnoreCase)
&& (CuratedFeedWantsAllVersions(cf.Version) || CuratedFeedSatisfiesDependency(cf.Version, d))
select new {Dependency = d, cf.Feed, FeedId = cf.Id}).ToList();
@@ -87,11 +87,14 @@ private IEnumerable<Package> GetMatchingPackages(string packageRegistrationId, s
var packageRegistrationRepository = GetService<IEntityRepository<PackageRegistration>>();
var candidatePackages = packageRegistrationRepository.GetAll()
.Include(pr => pr.Packages)
- .Where(pr => pr.Id == packageRegistrationId)
+ .Where(pr => pr.Id.Equals(packageRegistrationId, StringComparison.OrdinalIgnoreCase))
.SelectMany(pr => pr.Packages)
.Include(p => p.PackageRegistration)
.ToList();
+ if (requiredVersionSpec == null)
+ return candidatePackages;
+
var versionSpec = VersionUtility.ParseVersionSpec(requiredVersionSpec);
var dependencies = from p in candidatePackages
where versionSpec.Satisfies(new SemanticVersion(p.Version))

0 comments on commit 1758184

Please sign in to comment.