aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
authorLaria Carolin Chabowski <laria@laria.me>2020-10-04 14:29:17 +0200
committerLaria Carolin Chabowski <laria@laria.me>2020-10-04 14:29:17 +0200
commit55660b91440904d69a030a71de302d910f3f13b2 (patch)
treeb4cec79ff31574b360e892d6c6fca9db6dbf01ca /src/main/java
parentaf40819fcd9720bb68e6271b9ab29c6b6cdbae38 (diff)
downloadidea_caseconv-0.7.1.tar.gz
idea_caseconv-0.7.1.tar.bz2
idea_caseconv-0.7.1.zip
Fix crashing when an action is performed without a focussed editorv0.7.1
Turns out checking for a focussed editor in update() is not enough, because you can invoke the action, even if it's marked as inactive. Checking again in actionPerformed() fixes the issue.
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/me/laria/code/idea_caseconv/SelectionReplacerAction.java6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/main/java/me/laria/code/idea_caseconv/SelectionReplacerAction.java b/src/main/java/me/laria/code/idea_caseconv/SelectionReplacerAction.java
index 088a1e2..d715ac2 100644
--- a/src/main/java/me/laria/code/idea_caseconv/SelectionReplacerAction.java
+++ b/src/main/java/me/laria/code/idea_caseconv/SelectionReplacerAction.java
@@ -33,8 +33,10 @@ abstract class SelectionReplacerAction extends AnAction {
public void actionPerformed(AnActionEvent anActionEvent) {
Editor editor = anActionEvent.getData(CommonDataKeys.EDITOR);
Project project = anActionEvent.getData(CommonDataKeys.PROJECT);
- assert editor != null;
- assert project != null;
+
+ if (editor == null || project == null) {
+ return;
+ }
CaretModel caretModel = editor.getCaretModel();
Document document = editor.getDocument();