When a custom `FileView` is used and folder traversal is restricted to a particular directory NPE occurs when user tries to traverse/select other folders except traversable folder. This is caused because when user selects folder other than traversable, the traversal is rejected and hence no file is selected as `currentDirectory` of `JFileChooser`. When user tries to access the restricted folder second time, previous selected file check is failing because of NPE since `getFileChooser().getCurrentDirectory();` is null. To fix the issue, NPE check is added.
------------- Commit messages: - fix Changes: https://git.openjdk.org/jdk/pull/10485/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=10485&range=00 Issue: https://bugs.openjdk.org/browse/JDK-6616245 Stats: 113 lines in 2 files changed: 112 ins; 0 del; 1 mod Patch: https://git.openjdk.org/jdk/pull/10485.diff Fetch: git fetch https://git.openjdk.org/jdk pull/10485/head:pull/10485 PR: https://git.openjdk.org/jdk/pull/10485