diff --git a/CustomizePlus/Profiles/ProfileManager.cs b/CustomizePlus/Profiles/ProfileManager.cs index 49f06c7..cca9a92 100644 --- a/CustomizePlus/Profiles/ProfileManager.cs +++ b/CustomizePlus/Profiles/ProfileManager.cs @@ -440,7 +440,6 @@ public void AddTemporaryProfile(Profile profile, Actor actor) profile.Enabled = true; profile.ProfileType = ProfileType.Temporary; profile.Priority = int.MaxValue; //Make sure temporary profile is always at max priority - profile.Index = Profiles.Count; var permanentIdentifier = identifier.CreatePermanent(); profile.Characters.Clear(); @@ -453,6 +452,7 @@ public void AddTemporaryProfile(Profile profile, Actor actor) DeleteProfile(existingProfile); } + profile.Index = Profiles.Count; // capture index *after* potential DeleteProfile() above Profiles.Add(profile); _logger.Debug($"Added temporary profile for {permanentIdentifier}");