Skip to content

Commit

Permalink
fix exception when read not exist directory
Browse files Browse the repository at this point in the history
  • Loading branch information
cdcsgit committed Oct 12, 2021
1 parent ff1cc81 commit 4b322b9
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/com/blogspot/kotlinstudy/graphnote/MainUI.kt
Original file line number Diff line number Diff line change
Expand Up @@ -296,11 +296,14 @@ class MainUI(title: String) : JFrame() {

if (mCmdDirTF.text.isNotEmpty()) {
val dir = File(mCmdDirTF.text)
val listFiles = dir.listFiles { param -> param.isFile && param.canExecute() }
val listFiles: Array<File>? = dir.listFiles { param -> param.isFile && param.canExecute() }

mCmdCombo.removeAllItems()
for (item in listFiles) {
mCmdCombo.addItem(item.name)

if (listFiles != null) {
for (item in listFiles) {
mCmdCombo.addItem(item.name)
}
}
}
mCmdCombo.selectedItem = mConfigManager.mProperties[mConfigManager.ITEM_CMD_FILE] as? String
Expand Down

0 comments on commit 4b322b9

Please sign in to comment.