fix: crash when no installed javas detected
This commit is contained in:
parent
8b79d033dc
commit
13173a3798
3 changed files with 14 additions and 12 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1,6 +1,7 @@
|
|||
# Directories
|
||||
.gradle/
|
||||
.settings/
|
||||
.vscode/settings.json
|
||||
bin/
|
||||
build/
|
||||
dist/
|
||||
|
|
1
.vscode/settings.json
vendored
1
.vscode/settings.json
vendored
|
@ -1 +0,0 @@
|
|||
|
|
@ -243,20 +243,22 @@ public class JavaSettingsTab extends AbstractSettingsTab implements Relocalizati
|
|||
JComboBox<JavaInfo> installedJavas = new JComboBox<>();
|
||||
List<JavaInfo> systemJavas = Java.getInstalledJavas();
|
||||
|
||||
systemJavas.stream().forEach(javaInfo -> {
|
||||
installedJavas.addItem(javaInfo);
|
||||
});
|
||||
if (systemJavas.size() != 0) {
|
||||
systemJavas.stream().forEach(javaInfo -> {
|
||||
installedJavas.addItem(javaInfo);
|
||||
});
|
||||
|
||||
installedJavas.setSelectedItem(systemJavas.stream()
|
||||
.filter(javaInfo -> javaInfo.rootPath.equalsIgnoreCase(App.settings.getJavaPath())).findFirst()
|
||||
.get());
|
||||
installedJavas.setSelectedItem(systemJavas.stream()
|
||||
.filter(javaInfo -> javaInfo.rootPath.equalsIgnoreCase(App.settings.getJavaPath())).findFirst()
|
||||
.get());
|
||||
|
||||
installedJavas.addActionListener(e -> {
|
||||
javaPath.setText(((JavaInfo) installedJavas.getSelectedItem()).rootPath);
|
||||
});
|
||||
installedJavas.addActionListener(e -> {
|
||||
javaPath.setText(((JavaInfo) installedJavas.getSelectedItem()).rootPath);
|
||||
});
|
||||
|
||||
if (installedJavas.getItemCount() != 0) {
|
||||
javaPathPanelTop.add(installedJavas);
|
||||
if (installedJavas.getItemCount() != 0) {
|
||||
javaPathPanelTop.add(installedJavas);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue