From 0bc41c015f4ec907de75fe215589b7e30a819b54 Mon Sep 17 00:00:00 2001 From: Cody Robibero Date: Mon, 26 Feb 2024 05:09:40 -0700 Subject: Store lyrics in the database as media streams (#9951) --- src/Jellyfin.Extensions/StringExtensions.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src') 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 /// The part left of the . public static ReadOnlySpan LeftPart(this ReadOnlySpan haystack, char needle) { + if (haystack.IsEmpty) + { + return ReadOnlySpan.Empty; + } + var pos = haystack.IndexOf(needle); return pos == -1 ? haystack : haystack[..pos]; } @@ -73,6 +78,11 @@ namespace Jellyfin.Extensions /// The part right of the . public static ReadOnlySpan RightPart(this ReadOnlySpan haystack, char needle) { + if (haystack.IsEmpty) + { + return ReadOnlySpan.Empty; + } + var pos = haystack.LastIndexOf(needle); if (pos == -1) { -- cgit v1.2.3