From 18afd6b88664846e88755e0415a965794fc94161 Mon Sep 17 00:00:00 2001 From: Benedikt Reinartz Date: Sun, 30 Jun 2024 20:57:16 +0200 Subject: [PATCH] Add null checks before binding --- src/runtime/ClassManager.cs | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) 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) { pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy