prevent NPE

This commit is contained in:
Milos Kozak 2021-10-24 00:58:17 +02:00
parent 5e3db95297
commit 22cad1a761

View file

@ -1,5 +1,6 @@
package info.nightscout.androidaps.activities.fragments
import android.annotation.SuppressLint
import android.graphics.Paint
import android.os.Bundle
import android.view.LayoutInflater
@ -84,6 +85,7 @@ class TreatmentsBolusCarbsFragment : DaggerFragment() {
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View =
TreatmentsBolusCarbsFragmentBinding.inflate(inflater, container, false).also { _binding = it }.root
@SuppressLint("CheckResult")
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
binding.recyclerview.setHasFixedSize(true)
@ -320,7 +322,7 @@ class TreatmentsBolusCarbsFragment : DaggerFragment() {
init {
binding.calculation.setOnClickListener {
val mealLinkLoaded = it.tag as MealLink
val mealLinkLoaded = it.tag as MealLink? ?: return@setOnClickListener
mealLinkLoaded.bolusCalculatorResult?.let { bolusCalculatorResult ->
WizardInfoDialog().also { wizardDialog ->
wizardDialog.setData(bolusCalculatorResult)