Skip to content

Commit 9f4e05b

Browse files
committed
Fix crash in unused local variable inspection
1 parent f2479c9 commit 9f4e05b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/main/kotlin/io/runescript/plugin/ide/inspections/RuneScriptUnusedLocalVariableInspection.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class RuneScriptUnusedLocalVariableInspection : LocalInspectionTool() {
1515
override fun buildVisitor(holder: ProblemsHolder, isOnTheFly: Boolean): PsiElementVisitor {
1616
return object : RsVisitor() {
1717
override fun visitLocalVariableDeclarationStatement(o: RsLocalVariableDeclarationStatement) {
18-
val expr = o.expressionList[0]
18+
val expr = o.expressionList.getOrNull(0) ?: return
1919
val references = ReferencesSearch.search(expr, GlobalSearchScope.fileScope(expr.containingFile)).findAll()
2020
if (references.isEmpty()) {
2121
holder.registerProblem(o,

0 commit comments

Comments
 (0)