mirror of
https://github.com/bitwarden/browser
synced 2025-12-18 09:13:33 +00:00
null checks on sort function values
This commit is contained in:
@@ -166,6 +166,16 @@ export class FolderService implements FolderServiceAbstraction {
|
||||
|
||||
private getLocaleSortingFunction(): (a: FolderView, b: FolderView) => number {
|
||||
return (a, b) => {
|
||||
if (a.name == null && b.name != null) {
|
||||
return -1;
|
||||
}
|
||||
if (a.name != null && b.name == null) {
|
||||
return 1;
|
||||
}
|
||||
if (a.name == null && b.name == null) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return this.i18nService.collator ? this.i18nService.collator.compare(a.name, b.name) :
|
||||
a.name.localeCompare(b.name);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user