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;
|
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);
|
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:
|
default:
|
||||||
{
|
{
|
||||||
string readerName = reader.Name;
|
string readerName = reader.Name;
|
||||||
if (_validProviderIds!.TryGetValue(readerName, out string providerIdValue))
|
if (_validProviderIds!.TryGetValue(readerName, out string? providerIdValue))
|
||||||
{
|
{
|
||||||
var id = reader.ReadElementContentAsString();
|
var id = reader.ReadElementContentAsString();
|
||||||
if (!string.IsNullOrWhiteSpace(id))
|
if (!string.IsNullOrWhiteSpace(id))
|
||||||
|
|
|
@ -127,7 +127,13 @@ namespace MediaBrowser.LocalMetadata.Savers
|
||||||
|
|
||||||
private void SaveToFile(Stream stream, string path)
|
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
|
// On Windows, savint the file will fail if the file is hidden or readonly
|
||||||
FileSystem.SetAttributes(path, false, false);
|
FileSystem.SetAttributes(path, false, false);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user