From a1c5b87b55762e71f39d81931012ba5b86b2e4a5 Mon Sep 17 00:00:00 2001 From: huanghongxun Date: Wed, 3 Oct 2018 15:55:38 +0800 Subject: [PATCH] Fix crash when no game installed --- .../java/org/jackhuang/hmcl/ui/LeftPaneController.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/LeftPaneController.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/LeftPaneController.java index e044eef7d..cceae5ced 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/LeftPaneController.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/LeftPaneController.java @@ -57,7 +57,15 @@ public final class LeftPaneController extends AdvancedListBox { GameAdvancedListItem gameListItem = new GameAdvancedListItem(); gameListItem.actionButtonVisibleProperty().bind(Profiles.selectedVersionProperty().isNotNull()); - gameListItem.setOnAction(e -> Versions.modifyGameSettings(Profiles.getSelectedProfile(), Profiles.getSelectedVersion())); + gameListItem.setOnAction(e -> { + Profile profile = Profiles.getSelectedProfile(); + String version = Profiles.getSelectedVersion(); + if (version == null) { + Controllers.navigate(Controllers.getGameListPage()); + } else { + Versions.modifyGameSettings(profile, version); + } + }); ProfileAdvancedListItem profileListItem = new ProfileAdvancedListItem(); profileListItem.setOnAction(e -> Controllers.navigate(Controllers.getProfileListPage()));