From ad46bb9b6e4a362d6017d0136856d7709acf780f Mon Sep 17 00:00:00 2001 From: Ray Clark Date: Mon, 3 Oct 2022 11:20:47 +1100 Subject: [PATCH 1/2] Fixed NPE when scaling if no components are selected --- .../src/net/sf/openrocket/gui/main/DocumentSelectionModel.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/swing/src/net/sf/openrocket/gui/main/DocumentSelectionModel.java b/swing/src/net/sf/openrocket/gui/main/DocumentSelectionModel.java index 5d9277df7..dff4a0097 100644 --- a/swing/src/net/sf/openrocket/gui/main/DocumentSelectionModel.java +++ b/swing/src/net/sf/openrocket/gui/main/DocumentSelectionModel.java @@ -2,6 +2,7 @@ package net.sf.openrocket.gui.main; import java.util.ArrayList; import java.util.Arrays; +import java.util.Collections; import java.util.LinkedList; import java.util.List; @@ -90,7 +91,7 @@ public class DocumentSelectionModel { * @return the currently selected rocket components, or null. */ public List getSelectedComponents() { - if (componentSelection.size() == 0) return null; + if (componentSelection.size() == 0) return Collections.EMPTY_LIST; return componentSelection; } From 67bb0ebee7e2e708fd73fd263ff588ad6fdb7c12 Mon Sep 17 00:00:00 2001 From: Ray Clark Date: Tue, 4 Oct 2022 20:14:43 +1100 Subject: [PATCH 2/2] Changed EMPTY_LIST to emptyList() --- .../src/net/sf/openrocket/gui/main/DocumentSelectionModel.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/swing/src/net/sf/openrocket/gui/main/DocumentSelectionModel.java b/swing/src/net/sf/openrocket/gui/main/DocumentSelectionModel.java index dff4a0097..54848a521 100644 --- a/swing/src/net/sf/openrocket/gui/main/DocumentSelectionModel.java +++ b/swing/src/net/sf/openrocket/gui/main/DocumentSelectionModel.java @@ -91,7 +91,7 @@ public class DocumentSelectionModel { * @return the currently selected rocket components, or null. */ public List getSelectedComponents() { - if (componentSelection.size() == 0) return Collections.EMPTY_LIST; + if (componentSelection.size() == 0) return Collections.emptyList(); return componentSelection; }