Skip to content

Commit

Permalink
Fix menu crash on 2022.3 when no host is detected (#274)
Browse files Browse the repository at this point in the history
  • Loading branch information
ben-gibson committed Dec 16, 2022
1 parent e41e799 commit f7bed15
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 7 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# GitLink Changelog

## Unreleased
- Fix menu text crash on 2022.3 when no host is detected

## 4.3.0 - 2022-12-11
- Add basic copy Markdown action
Expand Down
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
[![Version](https://img.shields.io/jetbrains/plugin/v/8183-gitlink.svg)](https://plugins.jetbrains.com/plugin/8183-gitlink)
[![Rating](https://img.shields.io/jetbrains/plugin/r/stars/8183-gitlink.svg)](https://plugins.jetbrains.com/plugin/8183-gitlink)
[![Downloads](https://img.shields.io/jetbrains/plugin/d/8183-gitlink.svg)](https://plugins.jetbrains.com/plugin/8183-gitlink)
[![Backers](https://opencollective.com/gitlink/tiers/backer/badge.svg?label=backer&color=brightgreen)](https://opencollective.com/gitlink)
[![Sponsors](https://opencollective.com/gitlink/tiers/sponsor/badge.svg?label=sponsor&color=brightgreen)](https://opencollective.com/gitlink)
[![Donations](https://opencollective.com/gitlink/tiers/badge.svg?label=sponsor&color=brightgreen)](https://opencollective.com/gitlink)
[![Stand With Ukraine](https://raw.githubusercontent.com/vshymanskyy/StandWithUkraine/main/badges/StandWithUkraine.svg)](https://stand-with-ukraine.pp.ua)

<!-- Plugin description -->
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
pluginGroup = uk.co.ben_gibson.git.link
pluginName = GitLink
# SemVer format -> https://semver.org
pluginVersion = 4.3.0
pluginVersion = 4.3.1

# See https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html
# for insight into build numbers and IntelliJ Platform versions.
Expand Down
11 changes: 7 additions & 4 deletions src/main/kotlin/uk/co/ben_gibson/git/link/ui/actions/Action.kt
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,15 @@ abstract class Action(private val type: Type): DumbAwareAction() {

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

if (host == null) {
event.presentation.isEnabledAndVisible = false
return;
}

event.presentation.isEnabled = shouldBeEnabled(event)

host?.let {
event.presentation.icon = it.icon
event.presentation.text = GitLinkBundle.message("actions.${type.key}.title", it.name)
}
event.presentation.icon = host.icon
event.presentation.text = GitLinkBundle.message("actions.${type.key}.title", host.name)
}

override fun getActionUpdateThread(): ActionUpdateThread {
Expand Down

0 comments on commit f7bed15

Please sign in to comment.