From e481f56b65776dedb7c9f37f8d9b7a1d0049bc4a Mon Sep 17 00:00:00 2001 From: Mariotaku Lee Date: Wed, 25 Jan 2017 12:15:54 +0800 Subject: [PATCH] fixed NPE --- .../org/mariotaku/twidere/fragment/AbsStatusesFragment.kt | 8 ++++++-- .../org/mariotaku/twidere/fragment/StatusFragment.kt | 3 ++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/twidere/src/main/kotlin/org/mariotaku/twidere/fragment/AbsStatusesFragment.kt b/twidere/src/main/kotlin/org/mariotaku/twidere/fragment/AbsStatusesFragment.kt index 902146e34..b6b73abe9 100644 --- a/twidere/src/main/kotlin/org/mariotaku/twidere/fragment/AbsStatusesFragment.kt +++ b/twidere/src/main/kotlin/org/mariotaku/twidere/fragment/AbsStatusesFragment.kt @@ -47,9 +47,12 @@ import org.mariotaku.twidere.adapter.decorator.DividerItemDecoration import org.mariotaku.twidere.adapter.iface.ILoadMoreSupportAdapter import org.mariotaku.twidere.annotation.ReadPositionTag import org.mariotaku.twidere.annotation.Referral -import org.mariotaku.twidere.constant.* import org.mariotaku.twidere.constant.IntentConstants.* import org.mariotaku.twidere.constant.KeyboardShortcutConstants.* +import org.mariotaku.twidere.constant.displaySensitiveContentsKey +import org.mariotaku.twidere.constant.newDocumentApiKey +import org.mariotaku.twidere.constant.readFromBottomKey +import org.mariotaku.twidere.constant.rememberPositionKey import org.mariotaku.twidere.extension.model.getAccountType import org.mariotaku.twidere.graphic.like.LikeAnimationDrawable import org.mariotaku.twidere.loader.iface.IExtendedLoader @@ -403,7 +406,8 @@ abstract class AbsStatusesFragment protected constructor() : override fun onQuotedStatusClick(holder: IStatusViewHolder, position: Int) { val status = adapter.getStatus(position) ?: return - IntentUtils.openStatus(activity, status.account_key, status.quoted_id) + val quotedId = status.quoted_id ?: return + IntentUtils.openStatus(activity, status.account_key, quotedId) } override fun onStatusLongClick(holder: IStatusViewHolder, position: Int): Boolean { diff --git a/twidere/src/main/kotlin/org/mariotaku/twidere/fragment/StatusFragment.kt b/twidere/src/main/kotlin/org/mariotaku/twidere/fragment/StatusFragment.kt index 8a9978c32..c181c46fc 100644 --- a/twidere/src/main/kotlin/org/mariotaku/twidere/fragment/StatusFragment.kt +++ b/twidere/src/main/kotlin/org/mariotaku/twidere/fragment/StatusFragment.kt @@ -1080,7 +1080,8 @@ class StatusFragment : BaseFragment(), LoaderCallbacks { - IntentUtils.openStatus(adapter.context, status.account_key, status.quoted_id) + val quotedId = status.quoted_id ?: return + IntentUtils.openStatus(adapter.context, status.account_key, quotedId) } itemView.translateLabel -> { fragment.loadTranslation(adapter.status)