Trim user input so stuff doesn't break
This commit is contained in:
@@ -145,8 +145,8 @@ public sealed class Profile : ISavable
|
||||
{
|
||||
CreationDate = creationDate,
|
||||
UniqueId = obj["UniqueId"]?.ToObject<Guid>() ?? throw new ArgumentNullException("UniqueId"),
|
||||
Name = new LowerString(obj["Name"]?.ToObject<string>() ?? throw new ArgumentNullException("Name")),
|
||||
CharacterName = new LowerString(obj["CharacterName"]?.ToObject<string>() ?? throw new ArgumentNullException("CharacterName")),
|
||||
Name = new LowerString(obj["Name"]?.ToObject<string>()?.Trim() ?? throw new ArgumentNullException("Name")),
|
||||
CharacterName = new LowerString(obj["CharacterName"]?.ToObject<string>()?.Trim() ?? throw new ArgumentNullException("CharacterName")),
|
||||
LimitLookupToOwnedObjects = obj["LimitLookupToOwnedObjects"]?.ToObject<bool>() ?? throw new ArgumentNullException("LimitLookupToOwnedObjects"),
|
||||
Enabled = obj["Enabled"]?.ToObject<bool>() ?? throw new ArgumentNullException("Enabled"),
|
||||
ModifiedDate = obj["ModifiedDate"]?.ToObject<DateTimeOffset>() ?? creationDate,
|
||||
|
||||
@@ -199,6 +199,8 @@ public class ProfileManager : IDisposable
|
||||
/// </summary>
|
||||
public void Rename(Profile profile, string newName)
|
||||
{
|
||||
newName = newName.Trim();
|
||||
|
||||
var oldName = profile.Name.Text;
|
||||
if (oldName == newName)
|
||||
return;
|
||||
@@ -216,6 +218,8 @@ public class ProfileManager : IDisposable
|
||||
/// </summary>
|
||||
public void ChangeCharacterName(Profile profile, string newName)
|
||||
{
|
||||
newName = newName.Trim();
|
||||
|
||||
var oldName = profile.CharacterName.Text;
|
||||
if (oldName == newName)
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user