Enable nullable for UserItemData

MetadataResult.GetOrAddUserData doesn't ever get used and is probably broken since the migration to .NET Core as it still expects a Guid for userId
This commit is contained in:
Bond_009
2024-04-20 16:43:25 +02:00
parent eeb8c59ff2
commit d3f0346f04
9 changed files with 20 additions and 62 deletions

View File

@@ -379,7 +379,8 @@ namespace Emby.Server.Implementations.Library
private void SetDefaultSubtitleStreamIndex(MediaSourceInfo source, UserItemData userData, User user, bool allowRememberingSelection)
{
if (userData.SubtitleStreamIndex.HasValue
if (userData is not null
&& userData.SubtitleStreamIndex.HasValue
&& user.RememberSubtitleSelections
&& user.SubtitleMode != SubtitlePlaybackMode.None
&& allowRememberingSelection)
@@ -411,7 +412,7 @@ namespace Emby.Server.Implementations.Library
private void SetDefaultAudioStreamIndex(MediaSourceInfo source, UserItemData userData, User user, bool allowRememberingSelection)
{
if (userData.AudioStreamIndex.HasValue && user.RememberAudioSelections && allowRememberingSelection)
if (userData is not null && userData.AudioStreamIndex.HasValue && user.RememberAudioSelections && allowRememberingSelection)
{
var index = userData.AudioStreamIndex.Value;
// Make sure the saved index is still valid
@@ -434,7 +435,7 @@ namespace Emby.Server.Implementations.Library
if (mediaType == MediaType.Video)
{
var userData = item is null ? new UserItemData() : _userDataManager.GetUserData(user, item);
var userData = item is null ? null : _userDataManager.GetUserData(user, item);
var allowRememberingSelection = item is null || item.EnableRememberingTrackSelections;