Fix dict lookup in globalSettings.cs
This commit is contained in:
parent
0d8c82f8aa
commit
d4c0899ba9
1 changed files with 2 additions and 2 deletions
|
@ -9,7 +9,7 @@ namespace Geekbot.net.Lib.GlobalSettings
|
|||
public class GlobalSettings : IGlobalSettings
|
||||
{
|
||||
private readonly DatabaseContext _database;
|
||||
private Dictionary<string, string> _cache;
|
||||
private readonly Dictionary<string, string> _cache;
|
||||
|
||||
public GlobalSettings(DatabaseContext database)
|
||||
{
|
||||
|
@ -47,7 +47,7 @@ namespace Geekbot.net.Lib.GlobalSettings
|
|||
public string GetKey(string keyName)
|
||||
{
|
||||
var keyValue = "";
|
||||
if (string.IsNullOrEmpty(_cache[keyName]))
|
||||
if (string.IsNullOrEmpty(_cache.GetValueOrDefault(keyName)))
|
||||
{
|
||||
keyValue = _database.Globals.FirstOrDefault(k => k.Name.Equals(keyName))?.Value ?? string.Empty;
|
||||
_cache[keyName] = keyValue;
|
||||
|
|
Loading…
Reference in a new issue