Skip to content

Commit 7383691

Browse files
committed
adding a null check
1 parent 670cfa1 commit 7383691

File tree

1 file changed

+15
-13
lines changed

1 file changed

+15
-13
lines changed

app/src/main/kotlin/com/simplemobiletools/notes/pro/fragments/ChecklistFragment.kt

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -91,23 +91,25 @@ class ChecklistFragment : NoteFragment(), ChecklistItemsListener {
9191
}
9292

9393
private fun setupFragment() {
94+
if (activity == null || activity!!.isFinishing) {
95+
return
96+
}
97+
9498
val plusIcon = resources.getColoredDrawableWithColor(R.drawable.ic_plus_vector, if (activity!!.isBlackAndWhiteTheme()) Color.BLACK else Color.WHITE)
9599

96-
view.apply {
97-
with(checklist_fab) {
98-
setImageDrawable(plusIcon)
99-
background.applyColorFilter(activity!!.getAdjustedPrimaryColor())
100-
setOnClickListener {
101-
showNewItemDialog()
102-
}
100+
view.checklist_fab.apply {
101+
setImageDrawable(plusIcon)
102+
background.applyColorFilter(activity!!.getAdjustedPrimaryColor())
103+
setOnClickListener {
104+
showNewItemDialog()
103105
}
106+
}
104107

105-
with(fragment_placeholder_2) {
106-
setTextColor(activity!!.getAdjustedPrimaryColor())
107-
underlineText()
108-
setOnClickListener {
109-
showNewItemDialog()
110-
}
108+
view.fragment_placeholder_2.apply {
109+
setTextColor(activity!!.getAdjustedPrimaryColor())
110+
underlineText()
111+
setOnClickListener {
112+
showNewItemDialog()
111113
}
112114
}
113115

0 commit comments

Comments
 (0)