From 02787f722815a235a9db7c6428c258318b8093c8 Mon Sep 17 00:00:00 2001 From: Mariotaku Lee Date: Mon, 18 Jul 2016 10:14:51 +0800 Subject: [PATCH] fixed crashes --- .../mariotaku/twidere/activity/MediaViewerActivity.kt | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/twidere/src/main/kotlin/org/mariotaku/twidere/activity/MediaViewerActivity.kt b/twidere/src/main/kotlin/org/mariotaku/twidere/activity/MediaViewerActivity.kt index 566e4b9ef..dc3532500 100644 --- a/twidere/src/main/kotlin/org/mariotaku/twidere/activity/MediaViewerActivity.kt +++ b/twidere/src/main/kotlin/org/mariotaku/twidere/activity/MediaViewerActivity.kt @@ -283,14 +283,10 @@ class MediaViewerActivity : BaseActivity(), IExtendedActivity, ATEToolbarCustomi return 0 } - fun hasStatus(): Boolean { - return intent.hasExtra(EXTRA_STATUS) - } - - private val status: ParcelableStatus + private val status: ParcelableStatus? get() = intent.getParcelableExtra(EXTRA_STATUS) - private val initialMedia: ParcelableMedia + private val initialMedia: ParcelableMedia? get() = intent.getParcelableExtra(EXTRA_CURRENT_MEDIA) private val media: Array by lazy { @@ -298,8 +294,7 @@ class MediaViewerActivity : BaseActivity(), IExtendedActivity, ATEToolbarCustomi } protected fun processShareIntent(intent: Intent) { - if (!hasStatus()) return - val status = status + val status = status ?: return intent.putExtra(Intent.EXTRA_SUBJECT, IntentUtils.getStatusShareSubject(this, status)) intent.putExtra(Intent.EXTRA_TEXT, IntentUtils.getStatusShareText(this, status)) }