double-check action parameters (EA-76026 - KNPE: ShowExpressionTypeAction.actionPerformed)

This commit is contained in:
Dmitry Jemerov
2015-12-07 20:31:58 +01:00
parent 0ec57e7fee
commit d65c8fb06c
@@ -40,8 +40,8 @@ import org.jetbrains.kotlin.types.KotlinType
@Deprecated("Remove once we no longer support IDEA 14.1")
public class ShowExpressionTypeAction : AnAction() {
override fun actionPerformed(e: AnActionEvent) {
val editor = e.getData<Editor>(CommonDataKeys.EDITOR)!!
val psiFile = e.getData<PsiFile>(CommonDataKeys.PSI_FILE)!!
val editor = e.getData(CommonDataKeys.EDITOR) ?: return
val psiFile = e.getData(CommonDataKeys.PSI_FILE) as? KtFile ?: return
val type = if (editor.getSelectionModel().hasSelection()) {
val startOffset = editor.getSelectionModel().getSelectionStart()