1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-05 12:10:55 +00:00

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
2 changed files with 7 additions and 7 deletions

View File

@@ -124,8 +124,8 @@ namespace Godot.SourceGenerators
if (typeKind == TypeKind.Struct)
{
if (type.ContainingAssembly.Name == "GodotSharp" &&
type.ContainingNamespace.Name == "Godot")
if (type.ContainingAssembly?.Name == "GodotSharp" &&
type.ContainingNamespace?.Name == "Godot")
{
return type switch
{
@@ -208,9 +208,9 @@ namespace Godot.SourceGenerators
if (type.SimpleDerivesFrom(typeCache.GodotObjectType))
return MarshalType.GodotObjectOrDerived;
if (type.ContainingAssembly.Name == "GodotSharp")
if (type.ContainingAssembly?.Name == "GodotSharp")
{
switch (type.ContainingNamespace.Name)
switch (type.ContainingNamespace?.Name)
{
case "Godot":
return type switch
@@ -220,7 +220,7 @@ namespace Godot.SourceGenerators
_ => null
};
case "Collections"
when type.ContainingNamespace.FullQualifiedName() == "Godot.Collections":
when type.ContainingNamespace?.FullQualifiedName() == "Godot.Collections":
return type switch
{
{ Name: "Dictionary" } =>