C#: Enable nullability in Semmle.Util

This commit is contained in:
Calum Grant
2020-03-26 20:10:21 +00:00
parent 376779421d
commit 8a968dac81
13 changed files with 31 additions and 32 deletions

View File

@@ -127,8 +127,8 @@ namespace Semmle.Util
if (parent != null)
{
string name = Path.GetFileName(path);
string parentPath = cache.GetCanonicalPath(parent.FullName);
string? name = Path.GetFileName(path);
string? parentPath = cache.GetCanonicalPath(parent.FullName);
try
{
string[] entries = Directory.GetFileSystemEntries(parentPath, name);
@@ -313,14 +313,15 @@ namespace Semmle.Util
/// <returns>The canonical path.</returns>
public string GetCanonicalPath(string path)
{
string canonicalPath;
lock (cache)
if (!cache.TryGetValue(path, out canonicalPath))
{
if (!cache.TryGetValue(path, out var canonicalPath))
{
canonicalPath = pathStrategy.GetCanonicalPath(path, this);
AddToCache(path, canonicalPath);
}
return canonicalPath;
return canonicalPath;
}
}
}
}