Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tiny bug patch - Fixed null exception in error map #23

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions Solnet.Anchor/ClientGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -936,6 +936,9 @@ private MemberDeclarationSyntax GenerateErrorMapping(Idl idl)
{
foreach (var val in idl.Errors)
{
string error_msg = string.Empty;
if(val.Msg != null)
error_msg = val.Msg;
var errValue = InitializerExpression(
SyntaxKind.ComplexElementInitializerExpression,
SeparatedList<ExpressionSyntax>(
Expand All @@ -959,7 +962,7 @@ private MemberDeclarationSyntax GenerateErrorMapping(Idl idl)
Argument(
LiteralExpression(
SyntaxKind.StringLiteralExpression,
Literal(val.Msg)))})), default)}));
Literal(error_msg)))})), default)}));
syntaxNodeOrTokens = syntaxNodeOrTokens.Add(errValue);
syntaxNodeOrTokens = syntaxNodeOrTokens.Add(Token(SyntaxKind.CommaToken));
}
Expand Down Expand Up @@ -2218,4 +2221,4 @@ private string GetNormalizedName(string name)
return name;
}
}
}
}