java.lang.NullPointerException
java.lang.NullPointerException: {
… } must not be null
at com.sohu.sohuvideo.mvp.ui.fragment.popup.MVPPopUpMemberFragment.updateOpenVipButton(MVPPopUpMemberFragment.kt:659)
at com.sohu.sohuvideo.mvp.ui.fragment.popup.MVPPopUpMemberFragment.getPayMethod$lambda-7(MVPPopUpMemberFragment.kt:753)
at com.sohu.sohuvideo.mvp.ui.fragment.popup.MVPPopUpMemberFragment.lambda$VoN9PKy7LI8j4TpmoRFV_iZ_ksk(Unknown Source:0)
at com.sohu.sohuvideo.mvp.ui.fragment.popup.-$$Lambda$MVPPopUpMemberFragment$VoN9PKy7LI8j4TpmoRFV_iZ_ksk.run(Unknown Source:4)
at android.os.Handler.handleCallback(Handler.java:900)
at android.os.Handler.dispatchMessage(Handler.java:103)
at android.os.Looper.loop(Looper.java:219)
at android.app.ActivityThread.main(ActivityThread.java:8674)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:513)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1109)
这是什么鬼?一个大括号不能为null??
研究发现,是koltin的if表达式不能返回null
buttonText =
if (from == PayConstans.FROM_VIP_FULL_AD || from == PayConstans.FROM_STREAM_AD || privilegeId == PRIVILEGE_NO_AD) {
//广告拉起
fullScreenPayGuide.buttontextBean.`_$1`
} else if (from == PayConstans.FROM_VIP_FILM || from == PayConstans.FROM_VIP_TRAILER || from == PayConstans.FROM_VIDEO_DETAIL_FULL_PLAYER_TIP || from == PayConstans.FROM_VIP_MORE) {
fullScreenPayGuide.buttontextBean.`_$2`
} else if (from == PayConstans.FROM_VIP_RENEW
|| from == PayConstans.FROM_VIDEO_DETAIL_FULL_PLAYER_BUTTON
) {
fullScreenPayGuide.buttontextBean.`_$3`
} else if (from == PayConstans.FROM_HDR || from == PayConstans.FROM_DOWNLOAD || from == PayConstans.FROM_BULE || from == PayConstans.FROM_VIP_DANMU) {
fullScreenPayGuide.buttontextBean.`_$4`
} else {
fullScreenPayGuide.buttontextBean.`_$5`
}
fullScreenPayGuide.buttontextBean._$2
的结果是null,所以才导致了这个崩溃