pull/70/head
kunfei 5 years ago
parent e36afc427e
commit db38c6be0a
  1. 6
      app/src/main/java/io/legado/app/ui/widget/font/FontSelectDialog.kt

@ -41,11 +41,11 @@ class FontSelectDialog : DialogFragment(),
FontAdapter.CallBack {
lateinit var job: Job
private val fontFolderRequestCode = 35485
private lateinit var adapter: FontAdapter
private val fontFolder =
App.INSTANCE.filesDir.absolutePath + File.separator + "Fonts" + File.separator
override val coroutineContext: CoroutineContext
get() = job + Main
private var adapter: FontAdapter? = null
override fun onStart() {
super.onStart()
@ -144,7 +144,7 @@ class FontSelectDialog : DialogFragment(),
pathName.name.toLowerCase().matches(".*\\.[ot]tf".toRegex())
}?.let {
withContext(Main) {
adapter.setItems(it.toList())
adapter?.setItems(it.toList())
}
}
} catch (e: Exception) {
@ -161,7 +161,7 @@ class FontSelectDialog : DialogFragment(),
file.listFiles { pathName ->
pathName.name.toLowerCase().matches(".*\\.[ot]tf".toRegex())
}?.let {
adapter.setItems(it.toList())
adapter?.setItems(it.toList())
}
} catch (e: Exception) {
toast(e.localizedMessage ?: "")

Loading…
Cancel
Save