mirror of
https://github.com/sourcegit-scm/sourcegit.git
synced 2024-12-22 20:37:19 -08:00
Merge pull request #122 from gadfly3173/fix/dictionary-exception
fix: avoid potential IndexOutOfRangeException in Models.User
This commit is contained in:
commit
62838e5b05
1 changed files with 3 additions and 3 deletions
|
@ -1,4 +1,4 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Collections.Concurrent;
|
||||
|
||||
namespace SourceGit.Models
|
||||
{
|
||||
|
@ -36,11 +36,11 @@ namespace SourceGit.Models
|
|||
var email = data.Substring(nameEndIdx + 1);
|
||||
|
||||
User user = new User() { Name = name, Email = email };
|
||||
_caches.Add(data, user);
|
||||
_caches.TryAdd(data, user);
|
||||
return user;
|
||||
}
|
||||
}
|
||||
|
||||
private static Dictionary<string, User> _caches = new Dictionary<string, User>();
|
||||
private static ConcurrentDictionary<string, User> _caches = new ConcurrentDictionary<string, User>();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue