diff --git a/src/runtime/ClassManager.cs b/src/runtime/ClassManager.cs index 79ab20e82..0960e1019 100644 --- a/src/runtime/ClassManager.cs +++ b/src/runtime/ClassManager.cs @@ -288,15 +288,13 @@ internal static void InitClassBase(Type type, ClassBase impl, ReflectedClrType p Runtime.PyType_Modified(pyType.Reference); } - internal static bool ShouldBindMethod(MethodBase mb) - { - return (mb.IsPublic || mb.IsFamily || mb.IsFamilyOrAssembly); - } + internal static bool ShouldBindMethod(MethodBase mb) => + mb != null && + (mb.IsPublic || mb.IsFamily || mb.IsFamilyOrAssembly); - internal static bool ShouldBindField(FieldInfo fi) - { - return (fi.IsPublic || fi.IsFamily || fi.IsFamilyOrAssembly); - } + internal static bool ShouldBindField(FieldInfo fi) => + fi != null && + (fi.IsPublic || fi.IsFamily || fi.IsFamilyOrAssembly); internal static bool ShouldBindProperty(PropertyInfo pi) {