From 8cd3a2146890e31584716e196c40dd6ed13ca165 Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Thu, 25 Jan 2018 21:20:45 -0500 Subject: [PATCH] null and length check on name when sorting --- src/App/Models/Page/VaultListPageModel.cs | 4 ++-- src/App/Pages/Vault/VaultListCiphersPage.cs | 9 ++++++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/App/Models/Page/VaultListPageModel.cs b/src/App/Models/Page/VaultListPageModel.cs index 1c84d3b84..ef89920ac 100644 --- a/src/App/Models/Page/VaultListPageModel.cs +++ b/src/App/Models/Page/VaultListPageModel.cs @@ -23,7 +23,7 @@ namespace Bit.App.Models.Page if(string.IsNullOrWhiteSpace(Name) || Name.Length == 0) { - NameGroup = AppResources.Other; + NameGroup = "-"; } else if(Char.IsLetter(Name[0])) { @@ -35,7 +35,7 @@ namespace Bit.App.Models.Page } else { - NameGroup = AppResources.Other; + NameGroup = "-"; } switch(cipher.Type) diff --git a/src/App/Pages/Vault/VaultListCiphersPage.cs b/src/App/Pages/Vault/VaultListCiphersPage.cs index 326e4b651..8346e5ac4 100644 --- a/src/App/Pages/Vault/VaultListCiphersPage.cs +++ b/src/App/Pages/Vault/VaultListCiphersPage.cs @@ -341,9 +341,12 @@ namespace Bit.App.Pages .Select(s => new Cipher(s, _appSettingsService)) .OrderBy(s => { - // Sort numbers and letters before special characters - return !string.IsNullOrWhiteSpace(s.Name) && s.Name.Length > 0 && - Char.IsDigit(s.Name[0]) ? 0 : (Char.IsLetter(s.Name[0]) ? 1 : 2); + if(string.IsNullOrWhiteSpace(s.Name)) + { + return 2; + } + + return s.Name.Length > 0 && Char.IsDigit(s.Name[0]) ? 0 : (Char.IsLetter(s.Name[0]) ? 1 : 2); }) .ThenBy(s => s.Name) .ThenBy(s => s.Subtitle)