From 362044ab6d265303eb61e2dacc7c9dc28f54ff44 Mon Sep 17 00:00:00 2001 From: James Frowen Date: Thu, 5 Oct 2023 19:12:01 +0100 Subject: [PATCH] fix: fixing null ref when using syncObject if base type can't be resolved then it will throw NullReferenceException, adding null checks to avoid this --- Assets/Mirage/Weaver/Processors/SyncObjectProcessor.cs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Assets/Mirage/Weaver/Processors/SyncObjectProcessor.cs b/Assets/Mirage/Weaver/Processors/SyncObjectProcessor.cs index c1a2838fa7..4ecf537c71 100644 --- a/Assets/Mirage/Weaver/Processors/SyncObjectProcessor.cs +++ b/Assets/Mirage/Weaver/Processors/SyncObjectProcessor.cs @@ -78,10 +78,9 @@ private void GenerateReadersAndWriters(TypeReference tr) } } - if (tr != null) - { - GenerateReadersAndWriters(tr.Resolve().BaseType); - } + var baseType = tr?.Resolve()?.BaseType; + if (baseType != null) + GenerateReadersAndWriters(baseType); } private void RegisterSyncObjects(TypeDefinition netBehaviourSubclass)