C#: Guard against null assemblies

A symbol's containing assembly will be null if the symbol is shared
across multiple assemblies.
This commit is contained in:
Raul Santos 2022-09-22 12:41:38 +02:00
parent 8e14f9ba21
commit f6d60764d3
No known key found for this signature in database
GPG key ID: B532473AE3A803E4
2 changed files with 7 additions and 7 deletions

View file

@ -29,7 +29,7 @@ namespace Godot.SourceGenerators
{
while (symbol != null)
{
if (symbol.ContainingAssembly.Name == assemblyName &&
if (symbol.ContainingAssembly?.Name == assemblyName &&
symbol.ToString() == typeFullName)
{
return true;
@ -47,7 +47,7 @@ namespace Godot.SourceGenerators
while (symbol != null)
{
if (symbol.ContainingAssembly.Name == "GodotSharp")
if (symbol.ContainingAssembly?.Name == "GodotSharp")
return symbol;
symbol = symbol.BaseType;