Skip to content

Commit 5c08354

Browse files
authored
Fix bug when reading linux defaults (#2259)
If there is no GCM configuration defaults directory on Linux, we had been inadvertently returning `null` for the setting value! Fix the issue by explictly returning `false` (no setting found) to `TryGetExternalDefault` rather than `true` (setting found).
2 parents d31f62c + 010818d commit 5c08354

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/shared/Core/Interop/Linux/LinuxSettings.cs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,17 @@ protected internal override bool TryGetExternalDefault(string section, string sc
3535

3636
_extConfigCache ??= ReadExternalConfiguration();
3737

38+
if (_extConfigCache is null)
39+
return false; // No external config found (or failed to read)
40+
3841
string name = string.IsNullOrWhiteSpace(scope)
3942
? $"{section}.{property}"
4043
: $"{section}.{scope}.{property}";
4144

4245
// Check if the setting exists in the configuration
43-
if (!_extConfigCache?.TryGetValue(name, out value) ?? false)
46+
if (!_extConfigCache.TryGetValue(name, out value))
4447
{
45-
// No property exists (or failed to read config)
48+
// No property exists
4649
return false;
4750
}
4851

@@ -90,4 +93,4 @@ private IDictionary<string, string> ReadExternalConfiguration()
9093
return null;
9194
}
9295
}
93-
}
96+
}

0 commit comments

Comments
 (0)