1
0
mirror of https://github.com/bitwarden/server.git synced 2025-01-03 18:57:35 +01:00

null checks

This commit is contained in:
Kyle Spearrin 2018-07-30 21:36:11 -04:00
parent 9cdc024956
commit 99df132cc7

View File

@ -157,7 +157,7 @@ namespace Bit.Core.Models.Api
new string[] { nameof(Cipher.OrganizationId) }); new string[] { nameof(Cipher.OrganizationId) });
} }
if(!CollectionIds?.Any() ?? false) if(!CollectionIds?.Any() ?? true)
{ {
yield return new ValidationResult("You must select at least one collection.", yield return new ValidationResult("You must select at least one collection.",
new string[] { nameof(CollectionIds) }); new string[] { nameof(CollectionIds) });
@ -193,7 +193,7 @@ namespace Bit.Core.Models.Api
public IEnumerable<ValidationResult> Validate(ValidationContext validationContext) public IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
{ {
if(!Ciphers?.Any() ?? false) if(!Ciphers?.Any() ?? true)
{ {
yield return new ValidationResult("You must select at least one cipher.", yield return new ValidationResult("You must select at least one cipher.",
new string[] { nameof(Ciphers) }); new string[] { nameof(Ciphers) });
@ -222,7 +222,7 @@ namespace Bit.Core.Models.Api
} }
} }
if(!CollectionIds?.Any() ?? false) if(!CollectionIds?.Any() ?? true)
{ {
yield return new ValidationResult("You must select at least one collection.", yield return new ValidationResult("You must select at least one collection.",
new string[] { nameof(CollectionIds) }); new string[] { nameof(CollectionIds) });