Skip to content

Commit 0928c93

Browse files
committed
Use TryGetValue
1 parent e73c1b7 commit 0928c93

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

csharp/autobuilder/Semmle.Autobuild.CSharp.Tests/BuildScripts.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,9 +116,8 @@ bool IBuildActions.DirectoryExists(string dir)
116116

117117
string? IBuildActions.GetEnvironmentVariable(string name)
118118
{
119-
if (!GetEnvironmentVariable.ContainsKey(name))
120-
return null;
121-
return GetEnvironmentVariable[name];
119+
GetEnvironmentVariable.TryGetValue(name, out var ret);
120+
return ret;
122121
}
123122

124123
public string GetCurrentDirectory { get; set; } = "";

0 commit comments

Comments
 (0)