aboutsummaryrefslogtreecommitdiff
path: root/Emby.Naming/Video/CleanStringParser.cs
diff options
context:
space:
mode:
authorJoshua M. Boniface <joshua@boniface.me>2021-03-08 16:54:26 -0500
committerJoshua M. Boniface <joshua@boniface.me>2021-03-08 18:08:26 -0500
commit3c3b536e81eee787c2a0cbbc2ea0b7e26ccb6f1f (patch)
tree67e5754cc1648f1feac17e6d148c493a482ab0c2 /Emby.Naming/Video/CleanStringParser.cs
parenta10eea41ac76913cd1d7535938dd5af2b51b467f (diff)
Merge pull request #5406 from cvium/trycleanstring-dont-die-on-me
(cherry picked from commit 0ef8bea1251632a6b94ffc187efe4c36d220fdde) Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
Diffstat (limited to 'Emby.Naming/Video/CleanStringParser.cs')
-rw-r--r--Emby.Naming/Video/CleanStringParser.cs8
1 files changed, 7 insertions, 1 deletions
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<char> newName)
{
+ if (string.IsNullOrEmpty(name))
+ {
+ newName = ReadOnlySpan<char>.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<char>.Empty;
return false;
}
}