feat: Fixed a possible null reference exception.

This commit is contained in:
real-zony
2022-03-20 19:10:51 +08:00
parent 2b41658783
commit a1e9669843
2 changed files with 11 additions and 2 deletions

View File

@@ -103,7 +103,9 @@ namespace ZonyLrcTools.Cli.Commands.SubCommand
var warpTask = new WarpTask(ParallelNumber);
var warpTaskList = files.Select(file => warpTask.RunAsync(() => Task.Run(async () => await _tagLoader.LoadTagAsync(file))));
var result = (await Task.WhenAll(warpTaskList)).Where(m => !string.IsNullOrEmpty(m.Name) || !string.IsNullOrEmpty(m.Artist));
var result = (await Task.WhenAll(warpTaskList))
.Where(m => m != null)
.Where(m => !string.IsNullOrEmpty(m.Name) || !string.IsNullOrEmpty(m.Artist));
_logger.LogInformation($"已成功加载 {files.Count} 个音乐文件的标签信息。");