Skip to content

Commit 9a94d52

Browse files
authored
fix: null pointer exception in binding (#1963)
1 parent 9838ca6 commit 9a94d52

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/ReactiveUI/Bindings/Property/PropertyBinderImplementation.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -433,6 +433,11 @@ internal static IBindingTypeConverter GetConverterForTypes(Type lhs, Type rhs)
433433

434434
private static Func<object, object, object[], object> GetSetConverter(Type fromType, Type targetType)
435435
{
436+
if (fromType == null)
437+
{
438+
return null;
439+
}
440+
436441
lock (_setMethodCache)
437442
{
438443
var setter = _setMethodCache.Get((fromType, targetType));
@@ -456,7 +461,7 @@ private static Func<object, object, object[], object> GetSetConverter(Type fromT
456461
var defaultGetter = Reflection.GetValueFetcherOrThrow(viewExpression.GetMemberInfo());
457462
object SetThenGet(object paramTarget, object paramValue, object[] paramParams)
458463
{
459-
Func<object, object, object[], object> converter = GetSetConverter(paramValue.GetType(), viewExpression.Type);
464+
Func<object, object, object[], object> converter = GetSetConverter(paramValue?.GetType(), viewExpression.Type);
460465

461466
if (converter == null)
462467
{

0 commit comments

Comments
 (0)