Skip to content

Commit 146d392

Browse files
Fix fallback simplification
1 parent 3988a21 commit 146d392

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/NHibernate/Bytecode/Lightweight/ReflectionOptimizer.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public ReflectionOptimizer(System.Type mappedType, IGetter[] getters, ISetter[]
3838
: this(mappedType, getters, setters, null, null)
3939
{
4040
}
41-
41+
4242
/// <summary>
4343
/// Class constructor.
4444
/// </summary>
@@ -163,10 +163,10 @@ private static void EmitCastToReference(ILGenerator il, System.Type type)
163163

164164
private GetPropertyValueInvoker GenerateGetPropertyValueMethod(IGetter getter)
165165
{
166+
if (getter == null)
167+
return null;
166168
if (!(getter is IOptimizableGetter optimizableGetter))
167-
{
168169
return getter.Get;
169-
}
170170

171171
var method = CreateDynamicMethod(typeof(object), new[] { typeof(object) });
172172
var il = method.GetILGenerator();
@@ -183,10 +183,10 @@ private GetPropertyValueInvoker GenerateGetPropertyValueMethod(IGetter getter)
183183

184184
private SetPropertyValueInvoker GenerateSetPropertyValueMethod(ISetter setter)
185185
{
186+
if (setter == null)
187+
return null;
186188
if (!(setter is IOptimizableSetter optimizableSetter))
187-
{
188189
return setter.Set;
189-
}
190190

191191
// void (target, value) { ((ClassType) target).SetMethod((FieldType) value); }
192192
var method = CreateDynamicMethod(null, new[] { typeof(object), typeof(object) });

0 commit comments

Comments
 (0)