Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scenario Chooser fix #6072

Merged
merged 2 commits into from
Oct 7, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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