Skip to content

Commit ee32280

Browse files
authored
fix: prevent crash when activity is finishing or destroyed (#218)
1 parent 5691143 commit ee32280

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

app/src/main/kotlin/org/fossify/notes/activities/MainActivity.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -565,6 +565,10 @@ class MainActivity : SimpleActivity() {
565565

566566
private fun initViewPager(wantedNoteId: Long? = null) {
567567
NotesHelper(this).getNotes { notes ->
568+
if (isFinishing || isDestroyed) {
569+
return@getNotes
570+
}
571+
568572
notes.filter { it.shouldBeUnlocked(this) }
569573
.forEach(::removeProtection)
570574

0 commit comments

Comments
 (0)