aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/java/com
diff options
context:
space:
mode:
authorFabian Henneke <FabianHenneke@users.noreply.github.com>2020-04-22 18:13:56 +0200
committerGitHub <noreply@github.com>2020-04-22 18:13:56 +0200
commit00361a58c7c7935315087641077ad6e157ddbbef (patch)
tree5723a0bd71253eecbff5a56beb0399444e9999e9 /app/src/main/java/com
parent9c1cc8690d34d7824e1bb8b7e7766df0a152cd5a (diff)
Fix crash when using type independent sort (#734)
Diffstat (limited to 'app/src/main/java/com')
-rw-r--r--app/src/main/java/com/zeapo/pwdstore/SearchableRepositoryViewModel.kt4
1 files changed, 3 insertions, 1 deletions
diff --git a/app/src/main/java/com/zeapo/pwdstore/SearchableRepositoryViewModel.kt b/app/src/main/java/com/zeapo/pwdstore/SearchableRepositoryViewModel.kt
index 31258201..3dcca85f 100644
--- a/app/src/main/java/com/zeapo/pwdstore/SearchableRepositoryViewModel.kt
+++ b/app/src/main/java/com/zeapo/pwdstore/SearchableRepositoryViewModel.kt
@@ -92,7 +92,9 @@ private fun PasswordItem.Companion.makeComparator(
): Comparator<PasswordItem> {
return when (typeSortOrder) {
PasswordRepository.PasswordSortOrder.FOLDER_FIRST -> compareBy { it.type }
- PasswordRepository.PasswordSortOrder.INDEPENDENT -> compareBy<PasswordItem>()
+ // In order to let INDEPENDENT not distinguish between items based on their type, we simply
+ // declare them all equal at this stage.
+ PasswordRepository.PasswordSortOrder.INDEPENDENT -> Comparator<PasswordItem> { _, _ -> 0 }
PasswordRepository.PasswordSortOrder.FILE_FIRST -> compareByDescending { it.type }
}
.then(compareBy(nullsLast(CaseInsensitiveComparator)) {