Enable nullable for more files

This commit is contained in:
Bond_009 2023-02-23 19:09:16 +01:00
parent ecb5c48538
commit ab24c0e2cf
10 changed files with 8 additions and 29 deletions

View File

@ -172,12 +172,9 @@ public class GenresController : BaseJellyfinApiController
item ??= new Genre();
if (userId.Value.Equals(default))
{
return _dtoService.GetBaseItemDto(item, dtoOptions);
}
var user = _userManager.GetUserById(userId.Value);
var user = userId.Value.Equals(default)
? null
: _userManager.GetUserById(userId.Value);
return _dtoService.GetBaseItemDto(item, dtoOptions, user);
}

View File

@ -1,5 +1,3 @@
#nullable disable
#pragma warning disable CS1591
using System;

View File

@ -1,5 +1,3 @@
#nullable disable
using System;
using System.Collections.Generic;
using System.Globalization;

View File

@ -1,5 +1,3 @@
#nullable disable
using System;
using System.Collections.Generic;
using System.Globalization;

View File

@ -1,5 +1,3 @@
#nullable disable
using System;
using System.Collections.Generic;
using System.Globalization;

View File

@ -1,5 +1,3 @@
#nullable disable
using System;
using System.Collections.Generic;
using System.Globalization;
@ -63,7 +61,7 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.TV
var seriesTmdbId = Convert.ToInt32(series?.GetProviderId(MetadataProvider.Tmdb), CultureInfo.InvariantCulture);
if (seriesTmdbId <= 0)
if (series == null || seriesTmdbId <= 0)
{
return Enumerable.Empty<RemoteImageInfo>();
}

View File

@ -1,5 +1,3 @@
#nullable disable
using System;
using System.Collections.Generic;
using System.Globalization;
@ -87,7 +85,7 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.TV
return metadataResult;
}
info.SeriesProviderIds.TryGetValue(MetadataProvider.Tmdb.ToString(), out string tmdbId);
info.SeriesProviderIds.TryGetValue(MetadataProvider.Tmdb.ToString(), out string? tmdbId);
var seriesTmdbId = Convert.ToInt32(tmdbId, CultureInfo.InvariantCulture);
if (seriesTmdbId <= 0)

View File

@ -1,5 +1,3 @@
#nullable disable
using System;
using System.Collections.Generic;
using System.Globalization;

View File

@ -1,5 +1,3 @@
#nullable disable
#pragma warning disable CS1591
using System;
@ -56,7 +54,7 @@ namespace MediaBrowser.Providers.Subtitles
}
/// <inheritdoc />
public event EventHandler<SubtitleDownloadFailureEventArgs> SubtitleDownloadFailure;
public event EventHandler<SubtitleDownloadFailureEventArgs>? SubtitleDownloadFailure;
/// <inheritdoc />
public async Task<RemoteSubtitleInfo[]> SearchSubtitles(SubtitleSearchRequest request, CancellationToken cancellationToken)
@ -235,7 +233,7 @@ namespace MediaBrowser.Providers.Subtitles
private async Task TrySaveToFiles(Stream stream, List<string> savePaths)
{
List<Exception> exs = null;
List<Exception>? exs = null;
foreach (var savePath in savePaths)
{
@ -245,7 +243,7 @@ namespace MediaBrowser.Providers.Subtitles
try
{
Directory.CreateDirectory(Path.GetDirectoryName(savePath));
Directory.CreateDirectory(Path.GetDirectoryName(savePath) ?? throw new InvalidOperationException("Path can't be a root directory."));
var fileOptions = AsyncFile.WriteOptions;
fileOptions.Mode = FileMode.CreateNew;

View File

@ -1,5 +1,3 @@
#nullable disable
#pragma warning disable CS1591
using System.Collections.Generic;