Skip to content

Commit

Permalink
fix: fixing null ref when using syncObject
Browse files Browse the repository at this point in the history
if base type can't be resolved then it will throw NullReferenceException, adding null checks to avoid this
  • Loading branch information
James-Frowen committed Oct 5, 2023
1 parent 0ee6333 commit 362044a
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions Assets/Mirage/Weaver/Processors/SyncObjectProcessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 362044a

Please sign in to comment.