From ed30e2bf105b0cbc4661a6309973390391a58b08 Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Sun, 21 Mar 2021 13:52:15 +0100 Subject: [PATCH] fix NPE --- .../androidaps/plugins/general/food/FoodFragment.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/food/FoodFragment.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/food/FoodFragment.kt index 10ff172727..ceb0855819 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/food/FoodFragment.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/food/FoodFragment.kt @@ -200,8 +200,8 @@ class FoodFragment : DaggerFragment() { private fun filterData() { val textFilter = binding.filter.text.toString() - val categoryFilter = binding.category.selectedItem.toString() - val subcategoryFilter = binding.subcategory.selectedItem.toString() + val categoryFilter = binding.category.selectedItem?.toString() ?: resourceHelper.gs(R.string.none) + val subcategoryFilter = binding.subcategory.selectedItem?.toString() ?: resourceHelper.gs(R.string.none) val newFiltered = ArrayList() for (f in unfiltered) { if (f.category == null || f.subCategory == null) continue