From 5b4178176ac4c475cd41f35879ac309bfe874d5f Mon Sep 17 00:00:00 2001 From: Joel Uckelman Date: Thu, 14 Sep 2023 00:56:12 +0100 Subject: [PATCH 1/2] Check that editorWindow is nonnull before trying to use it. --- .../java/VASSAL/configure/ConfigureTree.java | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/vassal-app/src/main/java/VASSAL/configure/ConfigureTree.java b/vassal-app/src/main/java/VASSAL/configure/ConfigureTree.java index daa8fccd63..29e71a21e8 100644 --- a/vassal-app/src/main/java/VASSAL/configure/ConfigureTree.java +++ b/vassal-app/src/main/java/VASSAL/configure/ConfigureTree.java @@ -625,17 +625,21 @@ private List getSearchNodes(DefaultMutableTreeNode root) private void notifyUpdate(final Configurable target) { - if (target instanceof AbstractConfigurable) { - if (editorWindow.getListKeyCommands() != null) { - editorWindow.getListKeyCommands().updateConfigurable((AbstractConfigurable)target); + if (editorWindow != null) { + if (target instanceof AbstractConfigurable) { + if (editorWindow.getListKeyCommands() != null) { + editorWindow.getListKeyCommands().updateConfigurable((AbstractConfigurable)target); + } } } } private void notifyDelete(final Configurable target) { - if (target instanceof AbstractConfigurable) { - if (editorWindow.getListKeyCommands() != null) { - editorWindow.getListKeyCommands().deleteConfigurable((AbstractConfigurable)target); + if (editorWindow != null) { + if (target instanceof AbstractConfigurable) { + if (editorWindow.getListKeyCommands() != null) { + editorWindow.getListKeyCommands().deleteConfigurable((AbstractConfigurable)target); + } } } } From 061bab30fb29f31f47bd8a6ea375ad47dd402dcc Mon Sep 17 00:00:00 2001 From: Brent <90901032@westernsydney.edu.au> Date: Thu, 14 Sep 2023 10:56:41 +1000 Subject: [PATCH 2/2] Prevent any editing of component at all --- .../main/java/VASSAL/configure/ChooseComponentDialog.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/vassal-app/src/main/java/VASSAL/configure/ChooseComponentDialog.java b/vassal-app/src/main/java/VASSAL/configure/ChooseComponentDialog.java index f1075937ed..5f63201154 100644 --- a/vassal-app/src/main/java/VASSAL/configure/ChooseComponentDialog.java +++ b/vassal-app/src/main/java/VASSAL/configure/ChooseComponentDialog.java @@ -24,6 +24,7 @@ import VASSAL.tools.ScrollPane; import VASSAL.tools.swing.SwingUtils; +import javax.swing.Action; import javax.swing.Box; import javax.swing.BoxLayout; import javax.swing.JButton; @@ -61,6 +62,11 @@ public void mousePressed(MouseEvent e) { @Override public void mouseReleased(MouseEvent e) { } + + @Override + protected Action buildEditAction(Configurable target) { + return null; + } }; tree.addTreeSelectionListener(this); add(new ScrollPane(tree));