We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 29bea85 commit f8ce399Copy full SHA for f8ce399
src/main/kotlin/de/rakhman/angular_split_buttons/OpenAngularActions.kt
@@ -15,10 +15,10 @@ abstract class AbstractOpenAngularAction : AnAction() {
15
abstract val extensions: Map<String, Icon>
16
17
override fun update(e: AnActionEvent) {
18
- val file = e.getData(CommonDataKeys.PSI_FILE)!!
19
- val sibling = getSibling(file)
+ val file = e.getData(CommonDataKeys.PSI_FILE)
+ val sibling = file?.let { getSibling(it) }
20
21
- e.presentation.isEnabledAndVisible = !hasMatchingExtension(file) && sibling != null
+ e.presentation.isEnabledAndVisible = file != null && sibling != null && !hasMatchingExtension(file)
22
e.presentation.text = "Open ${sibling?.name}"
23
e.presentation.icon = sibling?.name?.substringAfterLast(".")?.let {
24
extensions[it.lowercase()]
0 commit comments