diff --git a/src/Core/Services/CollectionService.cs b/src/Core/Services/CollectionService.cs index 317beec51..95db22c9b 100644 --- a/src/Core/Services/CollectionService.cs +++ b/src/Core/Services/CollectionService.cs @@ -133,9 +133,9 @@ namespace Bit.Core.Services Id = c.Id, OrganizationId = c.OrganizationId }; - CoreHelpers.NestedTraverse(nodes, 0, - Regex.Replace(c.Name, "^\\/+|\\/+$", string.Empty).Split(NestingDelimiter), - collectionCopy, null, NestingDelimiter); + var parts = c.Name != null ? + Regex.Replace(c.Name, "^\\/+|\\/+$", string.Empty).Split(NestingDelimiter) : new string[] { }; + CoreHelpers.NestedTraverse(nodes, 0, parts, collectionCopy, null, NestingDelimiter); } return nodes; } diff --git a/src/Core/Services/FolderService.cs b/src/Core/Services/FolderService.cs index 9543d2e28..7215f8a46 100644 --- a/src/Core/Services/FolderService.cs +++ b/src/Core/Services/FolderService.cs @@ -127,9 +127,9 @@ namespace Bit.Core.Services Id = f.Id, RevisionDate = f.RevisionDate }; - CoreHelpers.NestedTraverse(nodes, 0, - Regex.Replace(f.Name, "^\\/+|\\/+$", string.Empty).Split(NestingDelimiter), - folderCopy, null, NestingDelimiter); + var parts = f.Name != null ? + Regex.Replace(f.Name, "^\\/+|\\/+$", string.Empty).Split(NestingDelimiter) : new string[] { }; + CoreHelpers.NestedTraverse(nodes, 0, parts, folderCopy, null, NestingDelimiter); } return nodes; }