forked from j62/ctbrec
Fix NPE in DirectorySelectionBox
This commit is contained in:
parent
2bedb6497a
commit
ef19e04751
|
@ -1,6 +1,7 @@
|
|||
package ctbrec.ui.controls;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Optional;
|
||||
|
||||
import javafx.stage.DirectoryChooser;
|
||||
|
||||
|
@ -12,7 +13,8 @@ public class DirectorySelectionBox extends AbstractFileSelectionBox {
|
|||
@Override
|
||||
protected void choose() {
|
||||
DirectoryChooser chooser = new DirectoryChooser();
|
||||
File currentDir = new File(fileProperty().get());
|
||||
String preselection = Optional.ofNullable(fileProperty().get()).orElse(".");
|
||||
File currentDir = new File(preselection);
|
||||
if (currentDir.exists() && currentDir.isDirectory()) {
|
||||
chooser.setInitialDirectory(currentDir);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue