Permalink
Browse files

Fix NullReferenceException error for pathless files

When the new VS Text Editor is opened with some special output
(e.g. Stack Trace Explorer in ReSharper), it has no path, so the
argument `path` is null, and NullReferenceException is thrown in
parser.Parse(string). So null-check must be needed.
  • Loading branch information...
1 parent 1863c74 commit 604439c4920fe8bc6e656addaf3cde659a68516d @takeshik takeshik committed Oct 19, 2016
Showing with 1 addition and 0 deletions.
  1. +1 −0 src/EditorConfig.VisualStudio/Helpers/SettingsExtensions.cs
@@ -11,6 +11,7 @@ internal static class ConfigLoader
public static bool TryLoad(string path, out FileConfiguration fileConfiguration)
{
fileConfiguration = null;
+ if (string.IsNullOrEmpty(path)) return false;
var parser = new EditorConfigParser();
var configurations = parser.Parse(path);
if (!configurations.Any()) return false;

0 comments on commit 604439c

Please sign in to comment.