don't update nonexistent progress bar (#549)

This commit is contained in:
Alex Burka 2019-09-30 00:58:20 -04:00 committed by Harsh Shandilya
parent 77efadc8ae
commit 4169af453b

View file

@ -722,7 +722,7 @@ class PgpActivity : AppCompatActivity(), OpenPgpServiceConnection.OnBound {
@Suppress("StaticFieldLeak") @Suppress("StaticFieldLeak")
inner class DelayShow(val activity: PgpActivity) : AsyncTask<Void, Int, Boolean>() { inner class DelayShow(val activity: PgpActivity) : AsyncTask<Void, Int, Boolean>() {
private val pb: ProgressBar by lazy { pbLoading } private val pb: ProgressBar? by lazy { pbLoading }
private var skip = false private var skip = false
private var cancelNotify = ConditionVariable() private var cancelNotify = ConditionVariable()
@ -761,7 +761,7 @@ class PgpActivity : AppCompatActivity(), OpenPgpServiceConnection.OnBound {
// treat 0 as forever, and the user must exit and/or clear clipboard on their own // treat 0 as forever, and the user must exit and/or clear clipboard on their own
cancel(true) cancel(true)
} else { } else {
this.pb.max = showTime this.pb?.max = showTime
} }
} }
@ -814,7 +814,7 @@ class PgpActivity : AppCompatActivity(), OpenPgpServiceConnection.OnBound {
} }
override fun onProgressUpdate(vararg values: Int?) { override fun onProgressUpdate(vararg values: Int?) {
this.pb.progress = values[0] ?: 0 this.pb?.progress = values[0] ?: 0
} }
} }