fixed some NPEs
This commit is contained in:
parent
92ab85adf9
commit
b67cc84718
|
@ -30,7 +30,7 @@ import org.mariotaku.twidere.model.UserKey
|
|||
|
||||
abstract class AbsStatusDialogActivity : BaseActivity() {
|
||||
|
||||
private val statusId: String
|
||||
private val statusId: String?
|
||||
get() = intent.getStringExtra(EXTRA_STATUS_ID)
|
||||
|
||||
private val accountKey: UserKey?
|
||||
|
@ -45,6 +45,11 @@ abstract class AbsStatusDialogActivity : BaseActivity() {
|
|||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
if (savedInstanceState == null) {
|
||||
val statusId = this.statusId ?: run {
|
||||
setResult(RESULT_CANCELED)
|
||||
finish()
|
||||
return
|
||||
}
|
||||
val accountKey = this.accountKey
|
||||
if (accountKey != null) {
|
||||
showDialogFragment(accountKey, statusId, status)
|
||||
|
@ -62,6 +67,11 @@ abstract class AbsStatusDialogActivity : BaseActivity() {
|
|||
when (requestCode) {
|
||||
REQUEST_SELECT_ACCOUNT -> {
|
||||
if (resultCode == RESULT_OK && data != null) {
|
||||
val statusId = this.statusId ?: run {
|
||||
setResult(RESULT_CANCELED)
|
||||
finish()
|
||||
return
|
||||
}
|
||||
val accountKey = data.getParcelableExtra<UserKey>(EXTRA_ACCOUNT_KEY)
|
||||
showDialogFragment(accountKey, statusId, status)
|
||||
return
|
||||
|
|
|
@ -369,7 +369,7 @@ abstract class AbsActivitiesFragment protected constructor() :
|
|||
}
|
||||
|
||||
override fun onQuotedStatusClick(holder: IStatusViewHolder, position: Int) {
|
||||
val status = getActivityStatus(position) ?: return
|
||||
val status = getActivityStatus(position)?.takeIf { it.quoted_id != null } ?: return
|
||||
IntentUtils.openStatus(context, status.account_key, status.quoted_id)
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue