From 2fdaf30510eb166f0ec6f4ecae335e5447f079af Mon Sep 17 00:00:00 2001 From: Holt59 Date: Thu, 1 Mar 2018 21:14:54 +0100 Subject: [PATCH] Fix issue in solution panel. --- .../insa/graphics/ShortestPathSolutionPanel.java | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/main/org/insa/graphics/ShortestPathSolutionPanel.java b/src/main/org/insa/graphics/ShortestPathSolutionPanel.java index 6fafbb8..e92fb11 100644 --- a/src/main/org/insa/graphics/ShortestPathSolutionPanel.java +++ b/src/main/org/insa/graphics/ShortestPathSolutionPanel.java @@ -92,6 +92,17 @@ public class ShortestPathSolutionPanel extends JPanel implements DrawingChangeLi oldOverlay.delete(); } } + + /* + * (non-Javadoc) + * + * @see java.lang.Object#toString() + */ + public String toString() { + return "Shortest-path from #" + this.getData().getOrigin().getId() + " to #" + + this.getData().getDestination().getId() + " [" + this.getData().getMode().toString().toLowerCase() + + "]"; + } } // Solution @@ -186,10 +197,11 @@ public class ShortestPathSolutionPanel extends JPanel implements DrawingChangeLi ShortestPathBundle bundle = (ShortestPathBundle) solutionSelect.getSelectedItem(); - if (currentBundle.getOverlay() != null) { + if (currentBundle != null && currentBundle.getOverlay() != null) { currentBundle.getOverlay().setVisible(false); } + updateInformationLabel(bundle); buttonPanel.setVisible(bundle.getSolution().isFeasible()); clearButton.setText(bundle.getSolution().isFeasible() ? "Hide" : "Show");