Skip to content

Commit 077e00f

Browse files
committed
Make a few changes according to the ideas of @daniel-theia
1 parent ea5cc72 commit 077e00f

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/main/java/app/freerouting/gui/MainApplication.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,11 @@ private void ExportBoardToFile(String filename) {
374374
int cancelButtonIndex = -1;
375375
for(Component c : optionPane.getComponents())
376376
// Ensure there are buttons on the panel
377-
if(c instanceof JPanel && ((JPanel)c).getComponents()[0] instanceof JButton && ((JPanel)c).getComponents()[1] instanceof JButton){
377+
if(c instanceof JPanel
378+
&& ((JPanel)c).getComponents().length >= 2
379+
&& ((JPanel)c).getComponents()[0] instanceof JButton
380+
&& ((JPanel)c).getComponents()[1] instanceof JButton
381+
){
378382
optionPanel = (JPanel)c;
379383

380384
JButton firstButton = (JButton)optionPanel.getComponents()[0];
@@ -396,8 +400,9 @@ private void ExportBoardToFile(String filename) {
396400
}
397401

398402
// Set the default button to "Start now"
403+
JButton startButton;
399404
if ((optionPanel != null) && (startButtonIndex >= 0)) {
400-
JButton startButton = (JButton) (optionPanel.getComponents()[startButtonIndex]);
405+
startButton = (JButton) (optionPanel.getComponents()[startButtonIndex]);
401406
startButton.setText(resources.getString("auto_start_routing_startnow_button"));
402407
startButton.addActionListener(
403408
e -> {

0 commit comments

Comments
 (0)