Skip to content

Commit a28afb9

Browse files
authored
Merge pull request #13 from CandyCoded/hotfix/check-length-dictionary
[hotfix] Check length of dictionary before parsing and returning.
2 parents a14ecda + 8d5678e commit a28afb9

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

Scripts/env.cs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,18 @@ public static class env
2323

2424
private static Dictionary<string, string> _variables = new();
2525

26-
public static Dictionary<string, string> variables => _variables ??= ParseEnvironmentFile();
26+
public static Dictionary<string, string> variables
27+
{
28+
get
29+
{
30+
if (_variables.Count == 0)
31+
{
32+
_variables = ParseEnvironmentFile();
33+
}
34+
35+
return _variables;
36+
}
37+
}
2738

2839
public static Dictionary<string, string> ParseEnvironmentFile(string contents)
2940
{

0 commit comments

Comments
 (0)