You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-07 12:30:27 +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:
@@ -29,7 +29,7 @@ namespace Godot.SourceGenerators
|
|||||||
{
|
{
|
||||||
while (symbol != null)
|
while (symbol != null)
|
||||||
{
|
{
|
||||||
if (symbol.ContainingAssembly.Name == assemblyName &&
|
if (symbol.ContainingAssembly?.Name == assemblyName &&
|
||||||
symbol.ToString() == typeFullName)
|
symbol.ToString() == typeFullName)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
@@ -47,7 +47,7 @@ namespace Godot.SourceGenerators
|
|||||||
|
|
||||||
while (symbol != null)
|
while (symbol != null)
|
||||||
{
|
{
|
||||||
if (symbol.ContainingAssembly.Name == "GodotSharp")
|
if (symbol.ContainingAssembly?.Name == "GodotSharp")
|
||||||
return symbol;
|
return symbol;
|
||||||
|
|
||||||
symbol = symbol.BaseType;
|
symbol = symbol.BaseType;
|
||||||
|
|||||||
@@ -124,8 +124,8 @@ namespace Godot.SourceGenerators
|
|||||||
|
|
||||||
if (typeKind == TypeKind.Struct)
|
if (typeKind == TypeKind.Struct)
|
||||||
{
|
{
|
||||||
if (type.ContainingAssembly.Name == "GodotSharp" &&
|
if (type.ContainingAssembly?.Name == "GodotSharp" &&
|
||||||
type.ContainingNamespace.Name == "Godot")
|
type.ContainingNamespace?.Name == "Godot")
|
||||||
{
|
{
|
||||||
return type switch
|
return type switch
|
||||||
{
|
{
|
||||||
@@ -208,9 +208,9 @@ namespace Godot.SourceGenerators
|
|||||||
if (type.SimpleDerivesFrom(typeCache.GodotObjectType))
|
if (type.SimpleDerivesFrom(typeCache.GodotObjectType))
|
||||||
return MarshalType.GodotObjectOrDerived;
|
return MarshalType.GodotObjectOrDerived;
|
||||||
|
|
||||||
if (type.ContainingAssembly.Name == "GodotSharp")
|
if (type.ContainingAssembly?.Name == "GodotSharp")
|
||||||
{
|
{
|
||||||
switch (type.ContainingNamespace.Name)
|
switch (type.ContainingNamespace?.Name)
|
||||||
{
|
{
|
||||||
case "Godot":
|
case "Godot":
|
||||||
return type switch
|
return type switch
|
||||||
@@ -220,7 +220,7 @@ namespace Godot.SourceGenerators
|
|||||||
_ => null
|
_ => null
|
||||||
};
|
};
|
||||||
case "Collections"
|
case "Collections"
|
||||||
when type.ContainingNamespace.FullQualifiedName() == "Godot.Collections":
|
when type.ContainingNamespace?.FullQualifiedName() == "Godot.Collections":
|
||||||
return type switch
|
return type switch
|
||||||
{
|
{
|
||||||
{ Name: "Dictionary" } =>
|
{ Name: "Dictionary" } =>
|
||||||
|
|||||||
Reference in New Issue
Block a user