[go: nahoru, domu]

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not merge - Only here to trigger CI on PR - https://github.com/wordpress-mobile/WordPress-Android/pull/20980 #20994

Merged
merged 6 commits into from
Jun 20, 2024
Prev Previous commit
Next Next commit
Remove !! from loadCategories() function
Co-Authored-By: Irfan Ömür <2471769+irfano@users.noreply.github.com>
  • Loading branch information
neeldoshii and irfano committed Jun 19, 2024
commit 4cf519e96a273e5b6a8340b9ec1373f0be6ff586
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ class AddCategoryFragment : AppCompatDialogFragment() {
private var site: SiteModel? = null
private var binding: AddCategoryBinding? = null

@set:Inject
var taxonomyStore: TaxonomyStore? = null
@Inject
lateinit var taxonomyStore: TaxonomyStore

override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
(requireActivity().application as WordPress).component().inject(this)
Expand Down Expand Up @@ -93,11 +93,7 @@ class AddCategoryFragment : AppCompatDialogFragment() {
}

private fun loadCategories() {
val rootCategory = CategoryNode.createCategoryTreeFromList(
taxonomyStore!!.getCategoriesForSite(
site!!
)
)
val rootCategory = site?.let { CategoryNode.createCategoryTreeFromList(taxonomyStore.getCategoriesForSite(it)) }
val categoryLevels = CategoryNode.getSortedListOfCategoriesFromRoot(rootCategory)
categoryLevels.add(0, CategoryNode(0, 0, getString(R.string.top_level_category_name)))
if (categoryLevels.size > 0) {
Expand Down