Handle null dictionaries

Former-commit-id: 1c851dc3ff
This commit is contained in:
Malte Rosenbjerg 2022-03-24 21:15:28 +01:00
parent f9d9458ebb
commit cfbecdfa9c

View file

@ -114,9 +114,9 @@ public static class MediaAnalysisUtils
{
private static readonly Regex DurationRegex = new Regex(@"^(\d+):(\d{1,2}):(\d{1,2})\.(\d{1,3})", RegexOptions.Compiled);
internal static Dictionary<string, string> ToCaseInsensitive(this Dictionary<string, string> dictionary)
internal static Dictionary<string, string>? ToCaseInsensitive(this Dictionary<string, string>? dictionary)
{
return dictionary.ToDictionary(tag => tag.Key, tag => tag.Value, StringComparer.OrdinalIgnoreCase);
return dictionary?.ToDictionary(tag => tag.Key, tag => tag.Value, StringComparer.OrdinalIgnoreCase) ?? new Dictionary<string, string>();
}
public static double DivideRatio((double, double) ratio) => ratio.Item1 / ratio.Item2;