From 55660b91440904d69a030a71de302d910f3f13b2 Mon Sep 17 00:00:00 2001 From: Laria Carolin Chabowski Date: Sun, 4 Oct 2020 14:29:17 +0200 Subject: Fix crashing when an action is performed without a focussed editor 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. --- .../java/me/laria/code/idea_caseconv/SelectionReplacerAction.java | 6 ++++-- src/main/resources/META-INF/plugin.xml | 5 ++++- 2 files changed, 8 insertions(+), 3 deletions(-) (limited to 'src/main') 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(); diff --git a/src/main/resources/META-INF/plugin.xml b/src/main/resources/META-INF/plugin.xml index 13e9403..5ce044e 100644 --- a/src/main/resources/META-INF/plugin.xml +++ b/src/main/resources/META-INF/plugin.xml @@ -1,7 +1,7 @@ me.laria.code.idea_caseconv Case conversion - 0.7.0 + 0.7.1 Laria Chabowski @@ -39,6 +39,9 @@
+
Version 0.7.1
+
Fix crashing when an action is performed without a focussed editor
+
Version 0.7.0
Add setting for newline mode and fix converting *from* dot.case
-- cgit v1.2.3-70-g09d2