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
committerGitHub <noreply@github.com>2021-03-08 16:54:26 -0500
commit0ef8bea1251632a6b94ffc187efe4c36d220fdde (patch)
tree36e6db7655ba50fbda2d5a64fb44ef45bbd1fe4f /Emby.Naming/Video/CleanStringParser.cs
parent82d88bdec6671fa6e89bf4e0844524799e9cbf11 (diff)
parentfcacae8cdeb3be15b27952d873ae08e29b6c7f94 (diff)
Merge pull request #5406 from cvium/trycleanstring-dont-die-on-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;
}
}