tastudio: duplicate hash check before adding.

This commit is contained in:
feos 2015-09-29 19:51:41 +03:00
parent 5b4845692a
commit f3ad71af24
2 changed files with 6 additions and 5 deletions

View File

@ -9,11 +9,6 @@ namespace BizHawk.Client.Common
{
public class TasBranch
{
public TasBranch()
{
UniqueIdentifier = Guid.NewGuid();
}
public int Frame { get; set; }
public byte[] CoreData { get; set; }
public List<string> InputLog { get; set; }

View File

@ -524,6 +524,12 @@ namespace BizHawk.Client.Common
public void AddBranch(TasBranch branch)
{
// before adding, make sure guid hash is unique too, we can't afford branch id clashes
do
{
branch.UniqueIdentifier = Guid.NewGuid();
} while (BranchIndexByHash(branch.UniqueIdentifier.GetHashCode()) != -1);
Branches.Add(branch);
TasStateManager.AddBranch();
Changes = true;