1
0
mirror of https://github.com/ncblakely/GiantsTools synced 2024-11-21 13:45:37 +01:00

Merge pull request #6 from ncblakely/users/tos/fixconfig

Fix config defaulting logic.
This commit is contained in:
ncblakely 2022-09-05 14:41:11 -07:00 committed by GitHub
commit 470d21ec09
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -39,13 +39,22 @@
if (this.userConfig.ContainsKey(section))
{
dynamic sectionObject = this.userConfig[section];
if (sectionObject != null)
if (sectionObject != null && sectionObject.ContainsKey(key))
{
return sectionObject.ContainsKey(key) ? (string)sectionObject[key] : "";
return (string)sectionObject[key];
}
}
return this.defaultConfig[section][key];
if (this.defaultConfig.ContainsKey(section))
{
dynamic sectionObject = this.defaultConfig[section];
if (sectionObject != null && sectionObject.ContainsKey(key))
{
return (string)sectionObject[key];
}
}
return string.Empty;
}
// TODO: other accessors unimplemented as we only need master server host name for now