Skip to content

Commit

Permalink
IDEA: UnusedQueryInspection - fix ArrayIndexOutOfBoundsException. (#3427
Browse files Browse the repository at this point in the history
)

* IDEA: UnusedQueryInspection - fix ArrayIndexOutOfBoundsException.

* Update sqldelight-idea-plugin/src/main/kotlin/app/cash/sqldelight/intellij/inspections/UnusedQueryInspection.kt

Co-authored-by: Alexander Perfilyev <alexander.perfilyev@gmail.com>

Co-authored-by: Alexander Perfilyev <alexander.perfilyev@gmail.com>
  • Loading branch information
vanniktech and aperfilyev committed Aug 10, 2022
1 parent e111772 commit 0d276ff
Showing 1 changed file with 6 additions and 1 deletion.
Expand Up @@ -38,7 +38,12 @@ internal class UnusedQueryInspection : LocalInspectionTool() {
fileName,
GlobalSearchScope.moduleScope(module),
).firstOrNull() as KtFile? ?: return PsiElementVisitor.EMPTY_VISITOR
val allMethods = generatedFile.classes[0].methods
val allMethods = generatedFile.classes.firstOrNull()?.methods

if (allMethods == null) {
return PsiElementVisitor.EMPTY_VISITOR
}

return object : SqlDelightVisitor() {
override fun visitStmtIdentifier(o: SqlDelightStmtIdentifier) = ignoreInvalidElements {
if (o !is StmtIdentifierMixin || o.identifier() == null) {
Expand Down

0 comments on commit 0d276ff

Please sign in to comment.