Skip to content

Commit

Permalink
Null check for sequences comparison (#432)
Browse files Browse the repository at this point in the history
  • Loading branch information
mdanish-kh authored Aug 16, 2023
1 parent 16564d3 commit 8fb5e37
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/WingetCreateCore/Models/Partials/InstallerPartials.cs
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,10 @@ public override bool Equals(object obj)
}

Dependencies other = (Dependencies)obj;
return this.WindowsFeatures.ToList().SequenceEqual(other.WindowsFeatures) &&
this.WindowsLibraries.ToList().SequenceEqual(this.WindowsLibraries) &&
this.PackageDependencies.ToList().SequenceEqual(other.PackageDependencies) &&
this.ExternalDependencies.ToList().SequenceEqual(other.ExternalDependencies);
return (this.PackageDependencies != null ? this.PackageDependencies.SequenceEqual(other.PackageDependencies) : true) &&
(this.WindowsLibraries != null ? this.WindowsLibraries.SequenceEqual(other.WindowsLibraries) : true) &&
(this.WindowsFeatures != null ? this.WindowsFeatures.SequenceEqual(other.WindowsFeatures) : true) &&
(this.ExternalDependencies != null ? this.ExternalDependencies.SequenceEqual(other.ExternalDependencies) : true);
}
}

Expand Down Expand Up @@ -150,7 +150,7 @@ public override bool Equals(object obj)

InstallationMetadata other = (InstallationMetadata)obj;
return this.DefaultInstallLocation == other.DefaultInstallLocation &&
this.Files.ToList().SequenceEqual(other.Files);
(this.Files != null ? this.Files.SequenceEqual(other.Files) : true);
}
}

Expand Down

0 comments on commit 8fb5e37

Please sign in to comment.