Skip to content

Commit f7bed15

Browse files
authored
Fix menu crash on 2022.3 when no host is detected (#274)
1 parent e41e799 commit f7bed15

File tree

4 files changed

+10
-7
lines changed

4 files changed

+10
-7
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
# GitLink Changelog
44

55
## Unreleased
6+
- Fix menu text crash on 2022.3 when no host is detected
67

78
## 4.3.0 - 2022-12-11
89
- Add basic copy Markdown action

README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@
44
[![Version](https://img.shields.io/jetbrains/plugin/v/8183-gitlink.svg)](https://plugins.jetbrains.com/plugin/8183-gitlink)
55
[![Rating](https://img.shields.io/jetbrains/plugin/r/stars/8183-gitlink.svg)](https://plugins.jetbrains.com/plugin/8183-gitlink)
66
[![Downloads](https://img.shields.io/jetbrains/plugin/d/8183-gitlink.svg)](https://plugins.jetbrains.com/plugin/8183-gitlink)
7-
[![Backers](https://opencollective.com/gitlink/tiers/backer/badge.svg?label=backer&color=brightgreen)](https://opencollective.com/gitlink)
8-
[![Sponsors](https://opencollective.com/gitlink/tiers/sponsor/badge.svg?label=sponsor&color=brightgreen)](https://opencollective.com/gitlink)
7+
[![Donations](https://opencollective.com/gitlink/tiers/badge.svg?label=sponsor&color=brightgreen)](https://opencollective.com/gitlink)
98
[![Stand With Ukraine](https://raw.githubusercontent.com/vshymanskyy/StandWithUkraine/main/badges/StandWithUkraine.svg)](https://stand-with-ukraine.pp.ua)
109

1110
<!-- Plugin description -->

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
pluginGroup = uk.co.ben_gibson.git.link
55
pluginName = GitLink
66
# SemVer format -> https://semver.org
7-
pluginVersion = 4.3.0
7+
pluginVersion = 4.3.1
88

99
# See https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html
1010
# for insight into build numbers and IntelliJ Platform versions.

src/main/kotlin/uk/co/ben_gibson/git/link/ui/actions/Action.kt

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,15 @@ abstract class Action(private val type: Type): DumbAwareAction() {
4444

4545
val host = project.service<PlatformLocator>().locate()
4646

47+
if (host == null) {
48+
event.presentation.isEnabledAndVisible = false
49+
return;
50+
}
51+
4752
event.presentation.isEnabled = shouldBeEnabled(event)
4853

49-
host?.let {
50-
event.presentation.icon = it.icon
51-
event.presentation.text = GitLinkBundle.message("actions.${type.key}.title", it.name)
52-
}
54+
event.presentation.icon = host.icon
55+
event.presentation.text = GitLinkBundle.message("actions.${type.key}.title", host.name)
5356
}
5457

5558
override fun getActionUpdateThread(): ActionUpdateThread {

0 commit comments

Comments
 (0)