Skip to content

Commit

Permalink
Fix NPE while checking whether to disable button
Browse files Browse the repository at this point in the history
shouldInstallButtonBeEnabled() switches on OptiFineSetting's value if OptiFineToggleSetting is enabled. However OptiFineSetting's value is null when OptiFine isn't supported by the current installation mode.

Fixes #117
  • Loading branch information
LeafHacker committed Jan 2, 2021
1 parent 84a042d commit 798a13f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Fixes
- Fix error checking whether to enable the Install button when OptiFine is enabled but not supported ([#117](https://github.com/ImpactDevelopment/Installer/issues/117))

## [0.9.3] - 2020-08-28

### Added
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,10 +139,14 @@ public MainPage(AppWindow app) {

private boolean shouldInstallButtonBeEnabled(InstallationConfig config) {
if (config.getSettingValue(OptiFineToggleSetting.INSTANCE)) {
switch (config.getSettingValue(OptiFineSetting.INSTANCE)) {
case MISSING:
case CUSTOM:
return Files.isRegularFile(config.getSettingValue(OptiFineFileSetting.INSTANCE));
// OptiFineSetting's value is null when the installation mode doesn't support optifine
String optifine = config.getSettingValue(OptiFineSetting.INSTANCE);
if (optifine != null) {
switch (optifine) {
case MISSING:
case CUSTOM:
return Files.isRegularFile(config.getSettingValue(OptiFineFileSetting.INSTANCE));
}
}
}
return true;
Expand Down

0 comments on commit 798a13f

Please sign in to comment.