Check for empty string in DefaultLyricProvider
This commit is contained in:
parent
6be45f73bc
commit
0ae4d175a1
|
@ -9,7 +9,7 @@ public class LyricFile
|
|||
/// Initializes a new instance of the <see cref="LyricFile"/> class.
|
||||
/// </summary>
|
||||
/// <param name="name">The name.</param>
|
||||
/// <param name="content">The content.</param>
|
||||
/// <param name="content">The content, must not be empty.</param>
|
||||
public LyricFile(string name, string content)
|
||||
{
|
||||
Name = name;
|
||||
|
|
|
@ -32,7 +32,10 @@ public class DefaultLyricProvider : ILyricProvider
|
|||
if (path is not null)
|
||||
{
|
||||
var content = await File.ReadAllTextAsync(path).ConfigureAwait(false);
|
||||
return new LyricFile(path, content);
|
||||
if (content.Length != 0)
|
||||
{
|
||||
return new LyricFile(path, content);
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
|
|
|
@ -32,12 +32,6 @@ public class TxtLyricParser : ILyricParser
|
|||
}
|
||||
|
||||
string[] lyricTextLines = lyrics.Content.Split(_lineBreakCharacters, StringSplitOptions.None);
|
||||
|
||||
if (lyricTextLines.Length == 0)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
LyricLine[] lyricList = new LyricLine[lyricTextLines.Length];
|
||||
|
||||
for (int lyricLineIndex = 0; lyricLineIndex < lyricTextLines.Length; lyricLineIndex++)
|
||||
|
|
Loading…
Reference in New Issue
Block a user