diff options
| author | Cody Robibero <cody@robibe.ro> | 2024-02-26 05:09:40 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-02-26 05:09:40 -0700 |
| commit | 0bc41c015f4ec907de75fe215589b7e30a819b54 (patch) | |
| tree | aade0ceab41e63b2f4833032dc380471166fc343 /src | |
| parent | 59f50ae8b2555b8caa19e743c3ba612e999f75bf (diff) | |
Store lyrics in the database as media streams (#9951)
Diffstat (limited to 'src')
| -rw-r--r-- | src/Jellyfin.Extensions/StringExtensions.cs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/Jellyfin.Extensions/StringExtensions.cs b/src/Jellyfin.Extensions/StringExtensions.cs index fd8f7e59a..9d8afc23c 100644 --- a/src/Jellyfin.Extensions/StringExtensions.cs +++ b/src/Jellyfin.Extensions/StringExtensions.cs @@ -61,6 +61,11 @@ namespace Jellyfin.Extensions /// <returns>The part left of the <paramref name="needle" />.</returns> public static ReadOnlySpan<char> LeftPart(this ReadOnlySpan<char> haystack, char needle) { + if (haystack.IsEmpty) + { + return ReadOnlySpan<char>.Empty; + } + var pos = haystack.IndexOf(needle); return pos == -1 ? haystack : haystack[..pos]; } @@ -73,6 +78,11 @@ namespace Jellyfin.Extensions /// <returns>The part right of the <paramref name="needle" />.</returns> public static ReadOnlySpan<char> RightPart(this ReadOnlySpan<char> haystack, char needle) { + if (haystack.IsEmpty) + { + return ReadOnlySpan<char>.Empty; + } + var pos = haystack.LastIndexOf(needle); if (pos == -1) { |
