tbruyelle / RxPermissions

Android runtime permissions powered by RxJava2
Apache License 2.0
10.48k stars 1.31k forks source link

RxPermissionsFragment.isGranted NullPointerException #226

Closed joedan0104 closed 6 years ago

joedan0104 commented 6 years ago

空指针异常,错误信息如下:

崩溃线程

main

格式化 1 Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'int android.app.Activity.checkSelfPermission(java.lang.String)' on a null object reference 2 at com.tbruyelle.rxpermissions2.RxPermissionsFragment.isGranted(TbsSdkJava:71) 3 at com.tbruyelle.rxpermissions2.RxPermissions.isGranted(TbsSdkJava:251) 4 at com.jindan.base.permission.PermissionManager.checkPermission(TbsSdkJava:82) 5 at com.shouse.star.ui.BaseMainActivity.startRefresh(TbsSdkJava:335) 6 at com.shouse.star.ui.BaseMainActivity$2.handleMessage(TbsSdkJava:252) 7 at android.os.Handler.dispatchMessage(Handler.java:105) 8 at android.os.Looper.loop(Looper.java:164)

epool commented 6 years ago

@joedan0104 looks like your RxPermission instance was linked to another activity and is no longer attached to your current activity. you must to have a RxPermission instance by Activity 1:1.

epool commented 6 years ago

If this error persists please create a demo project and share it here, thanks!