Fix a problem caused by getting project using an invalid psi element
This commit is contained in:
@@ -28,8 +28,8 @@ import org.jetbrains.kotlin.psi.KtFile
|
|||||||
abstract class KotlinQuickFixAction<T : PsiElement>(protected val element: T) : IntentionAction {
|
abstract class KotlinQuickFixAction<T : PsiElement>(protected val element: T) : IntentionAction {
|
||||||
|
|
||||||
override fun isAvailable(project: Project, editor: Editor?, file: PsiFile): Boolean {
|
override fun isAvailable(project: Project, editor: Editor?, file: PsiFile): Boolean {
|
||||||
return !element.project.isDisposed &&
|
return element.isValid &&
|
||||||
element.isValid &&
|
!element.project.isDisposed &&
|
||||||
(file.manager.isInProject(file) || file is KtCodeFragment) &&
|
(file.manager.isInProject(file) || file is KtCodeFragment) &&
|
||||||
(file is KtFile)
|
(file is KtFile)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user