mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-12-16 05:53:03 +03:00
Add clearer exceptions, warnings and docs
This commit is contained in:
@@ -42,6 +42,11 @@ namespace Emby.Server.Implementations.Library
|
||||
{
|
||||
var user = _userManager.GetUserById(query.UserId);
|
||||
|
||||
if (user == null)
|
||||
{
|
||||
throw new ArgumentException("User Id does not exists.", nameof(query));
|
||||
}
|
||||
|
||||
var folders = _libraryManager.GetUserRootFolder()
|
||||
.GetChildren(user, true)
|
||||
.OfType<Folder>()
|
||||
@@ -54,7 +59,7 @@ namespace Emby.Server.Implementations.Library
|
||||
foreach (var folder in folders)
|
||||
{
|
||||
var collectionFolder = folder as ICollectionFolder;
|
||||
var folderViewType = collectionFolder == null ? null : collectionFolder.CollectionType;
|
||||
var folderViewType = collectionFolder?.CollectionType;
|
||||
|
||||
if (UserView.IsUserSpecific(folder))
|
||||
{
|
||||
@@ -130,16 +135,11 @@ namespace Emby.Server.Implementations.Library
|
||||
{
|
||||
var index = orders.IndexOf(i.Id.ToString("N", CultureInfo.InvariantCulture));
|
||||
|
||||
if (index == -1)
|
||||
if (index == -1
|
||||
&& i is UserView view
|
||||
&& view.DisplayParentId != Guid.Empty)
|
||||
{
|
||||
var view = i as UserView;
|
||||
if (view != null)
|
||||
{
|
||||
if (!view.DisplayParentId.Equals(Guid.Empty))
|
||||
{
|
||||
index = orders.IndexOf(view.DisplayParentId.ToString("N", CultureInfo.InvariantCulture));
|
||||
}
|
||||
}
|
||||
index = orders.IndexOf(view.DisplayParentId.ToString("N", CultureInfo.InvariantCulture));
|
||||
}
|
||||
|
||||
return index == -1 ? int.MaxValue : index;
|
||||
|
||||
Reference in New Issue
Block a user