Skip to content

Commit fb52004

Browse files
committed
Make BindingContext use strict call site type check
1 parent c7ca2b9 commit fb52004

1 file changed

Lines changed: 4 additions & 7 deletions

File tree

src/lib/Vertical/Cli/Binding/BindingContext.cs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -109,14 +109,11 @@ public void TryAddConverter(IValueConverter converter) => ValueConverters.TryAdd
109109
/// <returns><c>true</c> if <paramref name="callSite"/> was assigned.</returns>
110110
public bool TryGetCallSite<TModel>([NotNullWhen(true)] out AsyncCallSite<TModel>? callSite) where TModel : class
111111
{
112-
if (CallSite is AsyncCallSite<TModel> target)
113-
{
114-
callSite = WrapCallSite(target);
115-
return true;
116-
}
112+
callSite = CallSite?.GetType() == typeof(AsyncCallSite<TModel>)
113+
? (AsyncCallSite<TModel>)CallSite
114+
: null;
117115

118-
callSite = default;
119-
return false;
116+
return callSite is not null;
120117
}
121118

122119
/// <summary>

0 commit comments

Comments
 (0)