misc: chore: Fix numerous NullReferenceExceptions, InvalidOperationExceptions

This commit is contained in:
KeatonTheBot 2025-06-17 17:17:31 -05:00
parent 9b6b9146e2
commit d0abbc6da3
90 changed files with 667 additions and 533 deletions

View file

@ -147,20 +147,26 @@ namespace Ryujinx.Horizon.Kernel.Generators
List<SyscallIdAndName> syscalls = [];
foreach (var method in syntaxReceiver.SvcImplementations)
if (syntaxReceiver != null)
{
GenerateMethod32(generator, context.Compilation, method);
GenerateMethod64(generator, context.Compilation, method);
foreach (AttributeSyntax attribute in method.AttributeLists.SelectMany(attributeList =>
attributeList.Attributes.Where(attribute =>
GetCanonicalTypeName(context.Compilation, attribute) == TypeSvcAttribute)))
foreach (var method in syntaxReceiver.SvcImplementations)
{
syscalls.AddRange(from attributeArg in attribute.ArgumentList.Arguments
where attributeArg.Expression.Kind() == SyntaxKind.NumericLiteralExpression
select (LiteralExpressionSyntax)attributeArg.Expression
into numericLiteral
select new SyscallIdAndName((int)numericLiteral.Token.Value, method.Identifier.Text));
GenerateMethod32(generator, context.Compilation, method);
GenerateMethod64(generator, context.Compilation, method);
foreach (AttributeSyntax attribute in method.AttributeLists.SelectMany(attributeList =>
attributeList.Attributes.Where(attribute =>
GetCanonicalTypeName(context.Compilation, attribute) == TypeSvcAttribute)))
{
if (attribute.ArgumentList != null)
{
syscalls.AddRange(from attributeArg in attribute.ArgumentList.Arguments
where attributeArg.Expression.Kind() == SyntaxKind.NumericLiteralExpression
select (LiteralExpressionSyntax)attributeArg.Expression
into numericLiteral
select new SyscallIdAndName((int)numericLiteral.Token.Value, method.Identifier.Text));
}
}
}
}