mirror of
https://github.com/sourcegit-scm/sourcegit.git
synced 2024-12-22 20:37:19 -08:00
fix: avoid potential IndexOutOfRangeException in Models.User
This commit is contained in:
parent
73ee0ae2cd
commit
3b166a5c22
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