File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -19,9 +19,16 @@ public void NullEnumToNullClass()
1919
2020 MyClass myClass = new ( ) { TypeEmployer = MyEnum . User } ;
2121
22+ MyClass myClassNull = new ( ) { TypeEmployer = null } ;
23+
24+
2225 var _result = myClass ? . Adapt < MyDestination ? > ( ) ; // Work
2326
27+ var _resultNull = myClassNull . Adapt < MyDestination > ( ) ; // Null Not Error When (object)s if (MyEnum)s - NullReferenceException
28+
2429 _result . TypeEmployer . Key . ShouldBe ( MyEnum . User . ToString ( ) ) ;
30+
31+ _resultNull . TypeEmployer . ShouldBeNull ( ) ;
2532 }
2633
2734 /// <summary>
Original file line number Diff line number Diff line change @@ -312,11 +312,11 @@ public static Expression NullableEnumExtractor(this Expression param)
312312
313313 if ( _SourceType . IsNullable ( ) )
314314 {
315- var _genericType = param . Type . GetGenericArguments ( ) [ 0 ] ! ;
315+ var _genericType = param . Type . GetGenericArguments ( ) [ 0 ] ;
316316
317317 if ( _genericType . IsEnum )
318318 {
319- var ExtractionExpression = Expression . Convert ( param , _genericType ) ;
319+ var ExtractionExpression = Expression . Convert ( param , typeof ( object ) ) ;
320320 return ExtractionExpression ;
321321 }
322322
You can’t perform that action at this time.
0 commit comments