Skip to content

Commit 33a1798

Browse files
authored
Update EmberUtils.kt
1 parent 476a987 commit 33a1798

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

src/main/kotlin/com/emberjs/utils/EmberUtils.kt

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -150,12 +150,14 @@ class EmberUtils {
150150
val r = ref as PsiElement? ?: exp
151151

152152
if (r is JSVariable) {
153-
val v = r.children[1]
154-
val viewProvider = file.containingFile.viewProvider
155-
val ts = viewProvider.findElementAt(v.textOffset, JavaScriptSupportLoader.TYPESCRIPT)
156-
val js = viewProvider.findElementAt(v.textOffset, JavaScriptSupportLoader.ECMA_SCRIPT_6)
157-
if (ts is OuterLanguageElement || js is OuterLanguageElement) {
158-
return r
153+
val v = r.children.getOrNull(1)
154+
if (v != null) {
155+
val viewProvider = file.containingFile.viewProvider
156+
val ts = viewProvider.findElementAt(v.textOffset, JavaScriptSupportLoader.TYPESCRIPT)
157+
val js = viewProvider.findElementAt(v.textOffset, JavaScriptSupportLoader.ECMA_SCRIPT_6)
158+
if (ts is OuterLanguageElement || js is OuterLanguageElement) {
159+
return r
160+
}
159161
}
160162
}
161163

0 commit comments

Comments
 (0)