Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 3 additions & 17 deletions src/ReactiveUI/View/DefaultViewLocator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ internal DefaultViewLocator(Func<string, string>? viewModelToViewFunc = null) =>
return view;
}

view = AttemptViewResolutionFor(ToggleViewModelType(viewModel?.GetType()), contract);
view = AttemptViewResolutionFor(ToggleViewModelType(viewModel.GetType()), contract);

if (view is not null)
{
Expand All @@ -129,13 +129,8 @@ internal DefaultViewLocator(Func<string, string>? viewModelToViewFunc = null) =>
return null;
}

private static Type? ToggleViewModelType(Type? viewModelType)
private static Type? ToggleViewModelType(Type viewModelType)
{
if (viewModelType is null)
{
return null;
}

var viewModelTypeName = viewModelType.AssemblyQualifiedName;

if (viewModelTypeName is null)
Expand Down Expand Up @@ -199,12 +194,7 @@ private static string InterfaceifyTypeName(string typeName)
proposedViewTypeName = typeof(IViewFor<>).MakeGenericType(viewModelType).AssemblyQualifiedName;
view = AttemptViewResolution(proposedViewTypeName, contract);

if (view is not null)
{
return view;
}

return null;
return view;
}

private IViewFor? AttemptViewResolution(string? viewTypeName, string? contract)
Expand All @@ -218,10 +208,6 @@ private static string InterfaceifyTypeName(string typeName)
}

var service = Locator.Current.GetService(viewType, contract);
if (service is null)
{
return null;
}

if (service is not IViewFor view)
{
Expand Down