Skip to content

Commit 393cc9f

Browse files
committed
Fixed file dialog not opening in P11 dialog (issue kaikramer#752)
1 parent 49375be commit 393cc9f

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

kse/src/main/java/org/kse/gui/dialogs/DOpenPkcs11KeyStore.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,8 @@ private String[] getLibraryList() {
237237
private void browsePressed() {
238238
JFileChooser chooser = FileChooserFactory.getLibFileChooser();
239239

240-
File currentLibFile = new File(((String) jtfP11Library.getSelectedItem()).trim());
240+
String selectedItem = jtfP11Library.getSelectedItem() != null ? (String) jtfP11Library.getSelectedItem() : "";
241+
File currentLibFile = new File(selectedItem.trim());
241242

242243
if (currentLibFile.getParentFile() != null && currentLibFile.getParentFile().exists()) {
243244
chooser.setCurrentDirectory(currentLibFile.getParentFile());
@@ -261,8 +262,9 @@ private void browsePressed() {
261262
}
262263

263264
private void okPressed() {
265+
Object selectedItem = jtfP11Library.getSelectedItem();
266+
final String selectedLib = (selectedItem != null) ? ((String) selectedItem).trim() : "";
264267

265-
final String selectedLib = ((String) jtfP11Library.getSelectedItem()).trim();
266268
try {
267269
if (jrbUseExisting.isSelected()) {
268270

0 commit comments

Comments
 (0)