Fix nullability errors in MediaBrowser.LocalMetadata
This commit is contained in:
parent
9b7c5cddae
commit
38885ffd74
|
@ -486,7 +486,7 @@ namespace MediaBrowser.LocalMetadata.Images
|
|||
return false;
|
||||
}
|
||||
|
||||
private FileSystemMetadata GetImage(IEnumerable<FileSystemMetadata> files, string name)
|
||||
private FileSystemMetadata? GetImage(IEnumerable<FileSystemMetadata> files, string name)
|
||||
{
|
||||
return files.FirstOrDefault(i => !i.IsDirectory && string.Equals(name, _fileSystem.GetFileNameWithoutExtension(i), StringComparison.OrdinalIgnoreCase) && i.Length > 0);
|
||||
}
|
||||
|
|
|
@ -683,7 +683,7 @@ namespace MediaBrowser.LocalMetadata.Parsers
|
|||
default:
|
||||
{
|
||||
string readerName = reader.Name;
|
||||
if (_validProviderIds!.TryGetValue(readerName, out string providerIdValue))
|
||||
if (_validProviderIds!.TryGetValue(readerName, out string? providerIdValue))
|
||||
{
|
||||
var id = reader.ReadElementContentAsString();
|
||||
if (!string.IsNullOrWhiteSpace(id))
|
||||
|
|
|
@ -127,7 +127,13 @@ namespace MediaBrowser.LocalMetadata.Savers
|
|||
|
||||
private void SaveToFile(Stream stream, string path)
|
||||
{
|
||||
Directory.CreateDirectory(Path.GetDirectoryName(path));
|
||||
var directory = Path.GetDirectoryName(path);
|
||||
if (directory == null)
|
||||
{
|
||||
throw new NullReferenceException(nameof(directory));
|
||||
}
|
||||
|
||||
Directory.CreateDirectory(directory);
|
||||
// On Windows, savint the file will fail if the file is hidden or readonly
|
||||
FileSystem.SetAttributes(path, false, false);
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user