From e5eb273ef7b4a44201af49bc38fe735c15bb2107 Mon Sep 17 00:00:00 2001 From: rabbitism Date: Sun, 28 Jan 2024 00:14:12 +0800 Subject: [PATCH] fix: fix null exception. --- src/Ursa.Themes.Semi/Index.axaml.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Ursa.Themes.Semi/Index.axaml.cs b/src/Ursa.Themes.Semi/Index.axaml.cs index ba2235c..c7945a9 100644 --- a/src/Ursa.Themes.Semi/Index.axaml.cs +++ b/src/Ursa.Themes.Semi/Index.axaml.cs @@ -32,6 +32,7 @@ public class SemiTheme: Styles _locale = value; var resource = TryGetLocaleResource(value); var d = AvaloniaXamlLoader.Load(sp, new Uri(resource)) as ResourceDictionary; + if (d is null) return; foreach (var kv in d) { 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) {