Skip to content

Commit

Permalink
Merge pull request #6072 from SJuliez/scenario-chooser-fix
Browse files Browse the repository at this point in the history
Scenario Chooser fix
  • Loading branch information
SJuliez authored Oct 7, 2024
2 parents 89a48df + 77924f4 commit 23b8d60
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@
import megamek.client.ui.swing.CommonSettingsDialog;
import megamek.client.ui.swing.dialog.DialogButton;
import megamek.client.ui.swing.util.ClickableLabel;
import megamek.client.ui.swing.util.UIUtil;
import megamek.common.Configuration;
import megamek.common.annotations.Nullable;
import megamek.common.preference.PreferenceManager;
Expand Down Expand Up @@ -91,10 +90,12 @@ public ScenarioChooser(final JFrame parentFrame) {
return scenarioFileName;
}
Component selectedTab = tabbedPane.getSelectedComponent();
if (!(selectedTab instanceof ScenarioInfoPane) || !getResult().isConfirmed()) {
if (!(selectedTab instanceof ScenarioInfoPane selectedPane) || !getResult().isConfirmed()) {
return null;
} else if (selectedPane.getSelectedPreset() != null) {
return selectedPane.getSelectedPreset().getFileName();
} else {
return ((ScenarioInfoPane) selectedTab).getSelectedPreset().getFileName();
return null;
}
}

Expand Down

0 comments on commit 23b8d60

Please sign in to comment.