Skip to content

Commit a14ecda

Browse files
authored
Merge pull request #12 from CandyCoded/hotfix/fix-dictionary-usage
[hotfix] Fixed dictionary usage.
2 parents d43d0a0 + 41d4a43 commit a14ecda

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

Scripts/env.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public static class env
2121

2222
public static readonly string runtimeFilePath = Path.Combine(resourcesDirPath, $"{filename}.txt");
2323

24-
private static Dictionary<string, string> _variables;
24+
private static Dictionary<string, string> _variables = new();
2525

2626
public static Dictionary<string, string> variables => _variables ??= ParseEnvironmentFile();
2727

@@ -65,9 +65,7 @@ public static Dictionary<string, string> ParseEnvironmentFile()
6565
public static bool TryParseEnvironmentVariable(string key, out string value)
6666
{
6767

68-
value = variables[key];
69-
70-
return variables.ContainsKey(key);
68+
return variables.TryGetValue(key, out value);
7169

7270
}
7371

0 commit comments

Comments
 (0)