Skip to content

Commit

Permalink
Merge pull request #8967 from drewnoakes/fix-8966
Browse files Browse the repository at this point in the history
Fix invalid null value assertion in plugin code
  • Loading branch information
msftbot[bot] committed Mar 11, 2021
2 parents 7fbcff1 + ed46e69 commit 9f05f5a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
1 change: 0 additions & 1 deletion Plugins/GitUIPluginInterfaces/ManagedExtensibility.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ private static ExportProvider CreateExportProvider(string? applicationDataFolder

string defaultPluginsPath = Path.Combine(new FileInfo(Application.ExecutablePath).Directory.FullName, "Plugins");
string? userPluginsPath = UserPluginsPath;
Validates.NotNull(userPluginsPath);

var pluginFiles = PluginsPathScanner.GetFiles(defaultPluginsPath, userPluginsPath);
#if !CI_BUILD
Expand Down
7 changes: 4 additions & 3 deletions Plugins/GitUIPluginInterfaces/PluginsPathScanner.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System.Collections.Generic;
using System.IO;
using System.Linq;
using GitExtUtils;

namespace GitUIPluginInterfaces
{
Expand Down Expand Up @@ -29,13 +30,13 @@ public static class PluginsPathScanner
/// </example>
/// <param name="pluginsPaths">An array of filesystem paths to search for plugins in.</param>
/// <returns>An enumeration of found dll files.</returns>
public static IEnumerable<FileInfo> GetFiles(params string[] pluginsPaths)
public static IEnumerable<FileInfo> GetFiles(params string?[] pluginsPaths)
{
var result = Enumerable.Empty<FileInfo>();

foreach (string pluginsPath in pluginsPaths)
foreach (string? pluginsPath in pluginsPaths)
{
if (!string.IsNullOrEmpty(pluginsPath) && Directory.Exists(pluginsPath))
if (!Strings.IsNullOrEmpty(pluginsPath) && Directory.Exists(pluginsPath))
{
DirectoryInfo directory = new(pluginsPath);

Expand Down

0 comments on commit 9f05f5a

Please sign in to comment.