tastudio: duplicate hash check before adding.
This commit is contained in:
parent
5b4845692a
commit
f3ad71af24
|
@ -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; }
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue