This repository was archived by the owner on Dec 24, 2022. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +6
-2
lines changed Expand file tree Collapse file tree 2 files changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ namespace ServiceStack.Text
11
11
public sealed class EmitReflectionOptimizer : ReflectionOptimizer
12
12
{
13
13
private static EmitReflectionOptimizer provider ;
14
- public static EmitReflectionOptimizer Provider => provider ?? ( provider = new EmitReflectionOptimizer ( ) ) ;
14
+ public static EmitReflectionOptimizer Provider => provider ??= new EmitReflectionOptimizer ( ) ;
15
15
private EmitReflectionOptimizer ( ) { }
16
16
17
17
public override Type UseType ( Type type )
@@ -52,6 +52,8 @@ public override GetMemberDelegate CreateGetter(PropertyInfo propertyInfo)
52
52
}
53
53
54
54
var mi = propertyInfo . GetGetMethod ( true ) ;
55
+ if ( mi == null )
56
+ return null ;
55
57
gen . Emit ( mi . IsFinal ? OpCodes . Call : OpCodes . Callvirt , mi ) ;
56
58
57
59
if ( propertyInfo . PropertyType . IsValueType )
@@ -70,6 +72,8 @@ public override GetMemberDelegate<T> CreateGetter<T>(PropertyInfo propertyInfo)
70
72
71
73
var gen = getter . GetILGenerator ( ) ;
72
74
var mi = propertyInfo . GetGetMethod ( true ) ;
75
+ if ( mi == null )
76
+ return null ;
73
77
74
78
if ( typeof ( T ) . IsValueType )
75
79
{
Original file line number Diff line number Diff line change @@ -36,7 +36,7 @@ public abstract class ReflectionOptimizer
36
36
public sealed class RuntimeReflectionOptimizer : ReflectionOptimizer
37
37
{
38
38
private static RuntimeReflectionOptimizer provider ;
39
- public static RuntimeReflectionOptimizer Provider => provider ?? ( provider = new RuntimeReflectionOptimizer ( ) ) ;
39
+ public static RuntimeReflectionOptimizer Provider => provider ??= new RuntimeReflectionOptimizer ( ) ;
40
40
private RuntimeReflectionOptimizer ( ) { }
41
41
42
42
public override Type UseType ( Type type ) => type ;
You can’t perform that action at this time.
0 commit comments