fix: fix null exception.

This commit is contained in:
rabbitism
2024-01-28 00:14:12 +08:00
parent f0c8d5dba5
commit e5eb273ef7

View File

@@ -32,6 +32,7 @@ public class SemiTheme: Styles
_locale = value; _locale = value;
var resource = TryGetLocaleResource(value); var resource = TryGetLocaleResource(value);
var d = AvaloniaXamlLoader.Load(sp, new Uri(resource)) as ResourceDictionary; var d = AvaloniaXamlLoader.Load(sp, new Uri(resource)) as ResourceDictionary;
if (d is null) return;
foreach (var kv in d) foreach (var kv in d)
{ {
this.Resources.Add(kv); this.Resources.Add(kv);
@@ -39,7 +40,7 @@ public class SemiTheme: Styles
} }
} }
private string TryGetLocaleResource(CultureInfo? locale) private static string TryGetLocaleResource(CultureInfo? locale)
{ {
if (locale is null) if (locale is null)
{ {