From 3c3b536e81eee787c2a0cbbc2ea0b7e26ccb6f1f Mon Sep 17 00:00:00 2001 From: "Joshua M. Boniface" Date: Mon, 8 Mar 2021 16:54:26 -0500 Subject: Merge pull request #5406 from cvium/trycleanstring-dont-die-on-me (cherry picked from commit 0ef8bea1251632a6b94ffc187efe4c36d220fdde) Signed-off-by: Joshua M. Boniface --- Emby.Naming/Video/CleanStringParser.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'Emby.Naming/Video/CleanStringParser.cs') diff --git a/Emby.Naming/Video/CleanStringParser.cs b/Emby.Naming/Video/CleanStringParser.cs index 09a0cd189..bd7553a91 100644 --- a/Emby.Naming/Video/CleanStringParser.cs +++ b/Emby.Naming/Video/CleanStringParser.cs @@ -33,6 +33,12 @@ namespace Emby.Naming.Video private static bool TryClean(string name, Regex expression, out ReadOnlySpan newName) { + if (string.IsNullOrEmpty(name)) + { + newName = ReadOnlySpan.Empty; + return false; + } + var match = expression.Match(name); int index = match.Index; if (match.Success && index != 0) @@ -41,7 +47,7 @@ namespace Emby.Naming.Video return true; } - newName = string.Empty; + newName = ReadOnlySpan.Empty; return false; } } -- cgit v1.2.3