fix potential crashes

This commit is contained in:
Phillip Thelen 2019-09-09 11:55:10 +02:00
parent 5445d54c43
commit b67d6c3edf
2 changed files with 9 additions and 2 deletions

View file

@ -209,7 +209,11 @@ class ChallengeFormActivity : BaseActivity() {
val bundle = intent.extras
challengeTasks = ChallengeTasksRecyclerViewAdapter(null, 0, this, "", null, false, true)
compositeSubscription.add(challengeTasks.taskOpenEvents.subscribe { openNewTaskActivity(it.type, it) })
compositeSubscription.add(challengeTasks.taskOpenEvents.subscribe {
if (it.isValid) {
openNewTaskActivity(it.type, it)
}
})
locationAdapter = GroupArrayAdapter(this)
if (bundle != null) {

View file

@ -1,5 +1,6 @@
package com.habitrpg.android.habitica.ui.views.dialogs
import android.app.Activity
import android.content.Context
import android.view.LayoutInflater
import android.view.View
@ -215,7 +216,9 @@ open class HabiticaAlertDialog(context: Context) : AlertDialog(context, R.style.
dialogQueue.removeAt(0)
}
if (dialogQueue.size > 0) {
dialogQueue[0].show()
if ((dialogQueue[0].context as? Activity)?.isFinishing == false) {
dialogQueue[0].show()
}
}
}