Skip to content

Commit

Permalink
Fix no such element error
Browse files Browse the repository at this point in the history
  • Loading branch information
niveathika committed Nov 27, 2021
1 parent 3879093 commit 6a3173a
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,11 @@ public void perform(SyntaxNodeAnalysisContext ctx) {
if (arguments.size() != 1) {
return;
}
TypeSymbol argumentTypeSymbol =
((TypeSymbol) ctx.semanticModel().symbol(node.arguments().get(0)).get());
Optional<Symbol> typeDescriptionArgument = ctx.semanticModel().symbol(node.arguments().get(0));
if (typeDescriptionArgument.isEmpty()) {
return;
}
TypeSymbol argumentTypeSymbol = ((TypeSymbol) typeDescriptionArgument.get());
TypeDescKind argTypeKind = argumentTypeSymbol.typeKind();
DiagnosticInfo diagnosticsForInvalidTypes = Utils.addDiagnosticsForInvalidTypes(objectName, argTypeKind);
if (diagnosticsForInvalidTypes != null) {
Expand Down

0 comments on commit 6a3173a

Please sign in to comment.