fixed crashes

This commit is contained in:
Mariotaku Lee 2016-07-18 10:14:51 +08:00
parent 991b54c37d
commit 02787f7228
1 changed files with 3 additions and 8 deletions

View File

@ -283,14 +283,10 @@ class MediaViewerActivity : BaseActivity(), IExtendedActivity, ATEToolbarCustomi
return 0 return 0
} }
fun hasStatus(): Boolean { private val status: ParcelableStatus?
return intent.hasExtra(EXTRA_STATUS)
}
private val status: ParcelableStatus
get() = intent.getParcelableExtra<ParcelableStatus>(EXTRA_STATUS) get() = intent.getParcelableExtra<ParcelableStatus>(EXTRA_STATUS)
private val initialMedia: ParcelableMedia private val initialMedia: ParcelableMedia?
get() = intent.getParcelableExtra<ParcelableMedia>(EXTRA_CURRENT_MEDIA) get() = intent.getParcelableExtra<ParcelableMedia>(EXTRA_CURRENT_MEDIA)
private val media: Array<ParcelableMedia> by lazy { private val media: Array<ParcelableMedia> by lazy {
@ -298,8 +294,7 @@ class MediaViewerActivity : BaseActivity(), IExtendedActivity, ATEToolbarCustomi
} }
protected fun processShareIntent(intent: Intent) { protected fun processShareIntent(intent: Intent) {
if (!hasStatus()) return val status = status ?: return
val status = status
intent.putExtra(Intent.EXTRA_SUBJECT, IntentUtils.getStatusShareSubject(this, status)) intent.putExtra(Intent.EXTRA_SUBJECT, IntentUtils.getStatusShareSubject(this, status))
intent.putExtra(Intent.EXTRA_TEXT, IntentUtils.getStatusShareText(this, status)) intent.putExtra(Intent.EXTRA_TEXT, IntentUtils.getStatusShareText(this, status))
} }