fix: ensure length > 0 and that arrays have value before validating

This commit is contained in:
2026-02-01 20:12:59 -05:00
parent 908441de4b
commit f95b347191
2 changed files with 5 additions and 5 deletions
@@ -26,7 +26,7 @@ namespace SharpbinV3.Server.DTOs
if (!ValidatePassword().IsMatch(Password))
results.Add(new ValidationResult("Password should have at least 8 characters, including uppercase, lowercase, and digits.", [nameof(Password)]));
if (DisplayName != null)
if (DisplayName != null && DisplayName.Length > 0)
{
if (DisplayName.Length < 3 || DisplayName.Length > 26)
results.Add(new ValidationResult("DisplayName must be between 3 and 26 characters.", [nameof(DisplayName)]));