Skip to content

Commit

Permalink
Fix #67
Browse files Browse the repository at this point in the history
  • Loading branch information
ghost1372 committed May 23, 2021
1 parent 31c9dae commit 8bd6245
Showing 1 changed file with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -122,12 +122,15 @@ public override object ProvideValue(IServiceProvider serviceProvider)
// if provider is null again, mybe we are in usercontrol so we can use mainwindow provider
if (ctlProvider == null)
{
object localValue = Application.Current.MainWindow.ReadLocalValue(LocalizationManager.ProviderProperty);
if (localValue != DependencyProperty.UnsetValue)
if (Application.Current.MainWindow != null)
{
if (localValue is ILocalizationProvider provider)
object localValue = Application.Current.MainWindow.ReadLocalValue(LocalizationManager.ProviderProperty);
if (localValue != DependencyProperty.UnsetValue)
{
ctlProvider = provider;
if (localValue is ILocalizationProvider provider)
{
ctlProvider = provider;
}
}
}
}
Expand Down

0 comments on commit 8bd6245

Please sign in to comment.