Check attachment path for null before use

This one is particularly nasty because the `Path` is not supposed to be nullable. However, fixing it in the parser and type constructor is beyond the scope of the 10.9 release. For now, just check with `IsNullOrEmpty`.

Signed-off-by: gnattu <gnattuoc@me.com>
This commit is contained in:
gnattu 2024-08-14 04:44:35 +08:00
parent 3f3145600c
commit 486c7fa51e

View File

@ -89,7 +89,8 @@ namespace MediaBrowser.MediaEncoding.Attachments
string outputPath,
CancellationToken cancellationToken)
{
var shouldExtractOneByOne = mediaSource.MediaAttachments.Any(a => a.FileName.Contains('/', StringComparison.OrdinalIgnoreCase) || a.FileName.Contains('\\', StringComparison.OrdinalIgnoreCase));
var shouldExtractOneByOne = mediaSource.MediaAttachments.Any(a => !string.IsNullOrEmpty(a.FileName)
&& (a.FileName.Contains('/', StringComparison.OrdinalIgnoreCase) || a.FileName.Contains('\\', StringComparison.OrdinalIgnoreCase)));
if (shouldExtractOneByOne)
{
var attachmentIndexes = mediaSource.MediaAttachments.Select(a => a.Index);