From e4d852e46f796401ce6411bb28c1d0e913b418a6 Mon Sep 17 00:00:00 2001 From: Sibo Van Gool Date: Tue, 1 Feb 2022 15:29:42 +0100 Subject: [PATCH] [fixes #1055] If no databranch in XML, data = null + status = NOT_SIMULATED --- .../file/openrocket/importt/FlightDataHandler.java | 8 +++++++- .../file/openrocket/importt/SingleSimulationHandler.java | 4 ++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/core/src/net/sf/openrocket/file/openrocket/importt/FlightDataHandler.java b/core/src/net/sf/openrocket/file/openrocket/importt/FlightDataHandler.java index 34c1d528d..6d90c7050 100644 --- a/core/src/net/sf/openrocket/file/openrocket/importt/FlightDataHandler.java +++ b/core/src/net/sf/openrocket/file/openrocket/importt/FlightDataHandler.java @@ -91,7 +91,13 @@ class FlightDataHandler extends AbstractElementHandler { @Override public void endHandler(String element, HashMap attributes, String content, WarningSet warnings) { - + + // If no tag in XML, then there is no sim data + if (dataHandler == null) { + data = null; + return; + } + if (branches.size() > 0) { data = new FlightData(branches.toArray(new FlightDataBranch[0])); } else { diff --git a/core/src/net/sf/openrocket/file/openrocket/importt/SingleSimulationHandler.java b/core/src/net/sf/openrocket/file/openrocket/importt/SingleSimulationHandler.java index 7834c285e..c559a2fca 100644 --- a/core/src/net/sf/openrocket/file/openrocket/importt/SingleSimulationHandler.java +++ b/core/src/net/sf/openrocket/file/openrocket/importt/SingleSimulationHandler.java @@ -134,6 +134,10 @@ class SingleSimulationHandler extends AbstractElementHandler { data = null; else data = dataHandler.getFlightData(); + + if (data == null) { + status = Status.NOT_SIMULATED; + } Simulation simulation = new Simulation(doc.getRocket(), status, name, options, extensions, data);