prevent NPE
This commit is contained in:
parent
8972ce676d
commit
6b26ef2e88
1 changed files with 5 additions and 5 deletions
|
@ -100,23 +100,23 @@ class DanaRHistoryActivity : NoSplashAppCompatActivity() {
|
||||||
danar_history_reload.setOnClickListener {
|
danar_history_reload.setOnClickListener {
|
||||||
val selected = danar_history_spinner.selectedItem as TypeList
|
val selected = danar_history_spinner.selectedItem as TypeList
|
||||||
runOnUiThread {
|
runOnUiThread {
|
||||||
danar_history_reload.visibility = View.GONE
|
danar_history_reload?.visibility = View.GONE
|
||||||
danar_history_status.visibility = View.VISIBLE
|
danar_history_status?.visibility = View.VISIBLE
|
||||||
}
|
}
|
||||||
clearCardView()
|
clearCardView()
|
||||||
ConfigBuilderPlugin.getPlugin().commandQueue.loadHistory(selected.type, object : Callback() {
|
ConfigBuilderPlugin.getPlugin().commandQueue.loadHistory(selected.type, object : Callback() {
|
||||||
override fun run() {
|
override fun run() {
|
||||||
loadDataFromDB(selected.type)
|
loadDataFromDB(selected.type)
|
||||||
runOnUiThread {
|
runOnUiThread {
|
||||||
danar_history_reload.visibility = View.VISIBLE
|
danar_history_reload?.visibility = View.VISIBLE
|
||||||
danar_history_status.visibility = View.GONE
|
danar_history_status?.visibility = View.GONE
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
danar_history_spinner.onItemSelectedListener = object : AdapterView.OnItemSelectedListener {
|
danar_history_spinner.onItemSelectedListener = object : AdapterView.OnItemSelectedListener {
|
||||||
override fun onItemSelected(parent: AdapterView<*>?, view: View, position: Int, id: Long) {
|
override fun onItemSelected(parent: AdapterView<*>?, view: View, position: Int, id: Long) {
|
||||||
val selected = danar_history_spinner.selectedItem as TypeList
|
val selected = danar_history_spinner?.selectedItem as TypeList? ?: return
|
||||||
loadDataFromDB(selected.type)
|
loadDataFromDB(selected.type)
|
||||||
showingType = selected.type
|
showingType = selected.type
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue