From 6b26ef2e88069652669184c48ef3def152facc1d Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Sat, 1 Feb 2020 22:44:23 +0100 Subject: [PATCH] prevent NPE --- .../pump/danaR/activities/DanaRHistoryActivity.kt | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/activities/DanaRHistoryActivity.kt b/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/activities/DanaRHistoryActivity.kt index 361f8e716e..d63ab0eb14 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/activities/DanaRHistoryActivity.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/activities/DanaRHistoryActivity.kt @@ -100,23 +100,23 @@ class DanaRHistoryActivity : NoSplashAppCompatActivity() { danar_history_reload.setOnClickListener { val selected = danar_history_spinner.selectedItem as TypeList runOnUiThread { - danar_history_reload.visibility = View.GONE - danar_history_status.visibility = View.VISIBLE + danar_history_reload?.visibility = View.GONE + danar_history_status?.visibility = View.VISIBLE } clearCardView() ConfigBuilderPlugin.getPlugin().commandQueue.loadHistory(selected.type, object : Callback() { override fun run() { loadDataFromDB(selected.type) runOnUiThread { - danar_history_reload.visibility = View.VISIBLE - danar_history_status.visibility = View.GONE + danar_history_reload?.visibility = View.VISIBLE + danar_history_status?.visibility = View.GONE } } }) } danar_history_spinner.onItemSelectedListener = object : AdapterView.OnItemSelectedListener { 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) showingType = selected.type }