Merge pull request #9381 from Bond-009/nullable

pull/9392/head
Cody Robibero 2 years ago committed by GitHub
commit 47b9a01efe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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);
}

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

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

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

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

@ -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 is null || seriesTmdbId <= 0)
{
return Enumerable.Empty<RemoteImageInfo>();
}

@ -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)

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

@ -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;

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

Loading…
Cancel
Save