Merge pull request #5406 from cvium/trycleanstring-dont-die-on-me

(cherry picked from commit 0ef8bea125)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
This commit is contained in:
Joshua M. Boniface
2021-03-08 16:54:26 -05:00
parent a10eea41ac
commit 3c3b536e81
2 changed files with 8 additions and 1 deletions

View File

@@ -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;
}
}