aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author1hitsong <3330318+1hitsong@users.noreply.github.com>2022-09-22 17:38:46 -0400
committer1hitsong <3330318+1hitsong@users.noreply.github.com>2022-09-22 17:38:46 -0400
commit563d5fb5d9c349555227a9e3e7d265a55d589c31 (patch)
tree6a5d5fa5457b05ae8de1fc2c57b0ea15f54938b0
parent97409adb45e84916fbd0b4b140ab794ac4279d56 (diff)
Return string.Empty is span IsEmpty
-rw-r--r--MediaBrowser.Providers/Lyric/LrcLyricProvider.cs6
-rw-r--r--MediaBrowser.Providers/Lyric/TxtLyricProvider.cs4
2 files changed, 6 insertions, 4 deletions
diff --git a/MediaBrowser.Providers/Lyric/LrcLyricProvider.cs b/MediaBrowser.Providers/Lyric/LrcLyricProvider.cs
index 05d8f2674..5844db078 100644
--- a/MediaBrowser.Providers/Lyric/LrcLyricProvider.cs
+++ b/MediaBrowser.Providers/Lyric/LrcLyricProvider.cs
@@ -201,11 +201,13 @@ public class LrcLyricProvider : ILyricProvider
private static string GetMetadataFieldName(string metaDataRow, int index)
{
- return metaDataRow.AsSpan(1, index - 1).Trim().ToString();
+ var metadataFieldName = metaDataRow.AsSpan(1, index - 1).Trim();
+ return metadataFieldName.IsEmpty ? string.Empty : metadataFieldName.ToString();
}
private static string GetMetadataValue(string metaDataRow, int index)
{
- return metaDataRow.AsSpan(index + 1, metaDataRow.Length - index - 2).Trim().ToString();
+ var metadataValue = metaDataRow.AsSpan(index + 1, metaDataRow.Length - index - 2).Trim();
+ return metadataValue.IsEmpty ? string.Empty : metadataValue.ToString();
}
}
diff --git a/MediaBrowser.Providers/Lyric/TxtLyricProvider.cs b/MediaBrowser.Providers/Lyric/TxtLyricProvider.cs
index 9d4f2f00e..85f792d09 100644
--- a/MediaBrowser.Providers/Lyric/TxtLyricProvider.cs
+++ b/MediaBrowser.Providers/Lyric/TxtLyricProvider.cs
@@ -48,9 +48,9 @@ public class TxtLyricProvider : ILyricProvider
LyricLine[] lyricList = new LyricLine[lyricTextLines.Length];
- for (int lyricLine = 0; lyricLine < lyricTextLines.Length; lyricLine++)
+ for (int lyricLineIndex = 0; lyricLineIndex < lyricTextLines.Length; lyricLineIndex++)
{
- lyricList[lyricLine] = new LyricLine(lyricTextLines[lyricLine]);
+ lyricList[lyricLineIndex] = new LyricLine(lyricTextLines[lyricLineIndex]);
}
return new LyricResponse { Lyrics = lyricList };