greysonp / permiso

An Android library to make handling runtime permissions a whole lot easier.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Fatal Exception: java.lang.NullPointerException: Attempt to read from field 'com.greysonparrelli.permiso.Permiso$d com.greysonparrelli.permiso.Permiso$c.b' on a null object

biovolt opened this issue · comments

commented

Hi
Thank you for the contribution you are making !!!

We get the following crash in our logs (Between 1 and 4 times per day), I have no idea on how to reproduce this.
I can not find anything on google or stackoverflow.

Do you have any suggestions on what might cause this crash?
We are using permiso version 0.3.0
The crashes is on android version 6 and 7 on a variety of handset manufacturers

Kind regards
Johan

Fatal Exception: java.lang.NullPointerException: Attempt to read from field 'com.greysonparrelli.permiso.Permiso$d com.greysonparrelli.permiso.Permiso$c.b' on a null object reference at com.greysonparrelli.permiso.Permiso.makePermissionRequest(Permiso.java:293) at com.greysonparrelli.permiso.Permiso.access$200(Permiso.java:25) at com.greysonparrelli.permiso.Permiso$1.onRationaleProvided(Permiso.java:133) at com.greysonparrelli.permiso.Permiso$2.onClose(Permiso.java:222) at com.greysonparrelli.permiso.PermisoDialogFragment$1.onClick(PermisoDialogFragment.java:120) at android.support.v7.app.AlertController$ButtonHandler.handleMessage(AlertController.java:161) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:148) at android.app.ActivityThread.main(ActivityThread.java:7325) at java.lang.reflect.Method.invoke(Method.java) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)

Hi! Sorry you're experiencing these crashes! The stack trace you've provided is proguarded - can you use the proguardMapping file to provide the true stack trace? That way I can help more effectively.

commented

Retrace does nothing to the trace :-(
I have manually searched and replaced $d $c and $c.b but I don't know how to replace $200 $1 and $2

Trace

Fatal Exception: java.lang.NullPointerException: Attempt to read from field 'com.greysonparrelli.permiso.Permiso$ResultSet com.greysonparrelli.permiso.Permiso$RequestData.resultSet' on a null object reference at com.greysonparrelli.permiso.Permiso.makePermissionRequest(Permiso.java:293) at com.greysonparrelli.permiso.Permiso.access$200(Permiso.java:25) at com.greysonparrelli.permiso.Permiso$1.onRationaleProvided(Permiso.java:133) at com.greysonparrelli.permiso.Permiso$2.onClose(Permiso.java:222) at com.greysonparrelli.permiso.PermisoDialogFragment$1.void onClick(android.content.DialogInterface,int)(PermisoDialogFragment.java:120) at android.support.v7.app.AlertController$ButtonHandler.void handleMessage(android.os.Message)(AlertController.java:161) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:148) at android.app.ActivityThread.main(ActivityThread.java:7325) at java.lang.reflect.Method.invoke(Method.java) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)

A section of the mapping file

com.greysonparrelli.permiso.Permiso -> com.greysonparrelli.permiso.Permiso: java.util.Map mCodesToRequests -> a java.lang.ref.WeakReference mActivity -> b int mActiveRequestCode -> c com.greysonparrelli.permiso.Permiso sInstance -> d 62:62:com.greysonparrelli.permiso.Permiso getInstance() -> a 46:70:void <init>() -> <init> 86:87:void setActivity(android.app.Activity) -> a 100:141:void requestPermissions(com.greysonparrelli.permiso.Permiso$IOnPermissionResult,java.lang.String[]) -> a 157:166:void onRequestPermissionResult(int,java.lang.String[],int[]) -> a 187:192:void showRationaleInDialog(java.lang.String,java.lang.String,java.lang.String,com.greysonparrelli.permiso.Permiso$IOnRationaleProvided) -> a 207:226:void showRationaleInDialog(com.greysonparrelli.permiso.PermisoDialogFragment$Builder,com.greysonparrelli.permiso.Permiso$IOnRationaleProvided) -> a 240:273:boolean linkToExistingRequestIfPossible(com.greysonparrelli.permiso.Permiso$RequestData) -> a 281:283:int markRequestAsActive(com.greysonparrelli.permiso.Permiso$RequestData) -> b 291:294:void makePermissionRequest(int) -> a 301:305:android.app.Activity checkActivity() -> b 25:25:void access$200(com.greysonparrelli.permiso.Permiso,int) -> a 51:51:void <clinit>() -> <clinit> com.greysonparrelli.permiso.Permiso$1 -> com.greysonparrelli.permiso.Permiso$1: int val$requestCode -> a com.greysonparrelli.permiso.Permiso this$0 -> b 130:130:void <init>(com.greysonparrelli.permiso.Permiso,int) -> <init> 133:134:void onRationaleProvided() -> a com.greysonparrelli.permiso.Permiso$2 -> com.greysonparrelli.permiso.Permiso$2: com.greysonparrelli.permiso.Permiso$IOnRationaleProvided val$rationaleCallback -> a com.greysonparrelli.permiso.Permiso this$0 -> b 219:219:void <init>(com.greysonparrelli.permiso.Permiso,com.greysonparrelli.permiso.Permiso$IOnRationaleProvided) -> <init> 222:223:void onClose() -> a com.greysonparrelli.permiso.Permiso -> com.greysonparrelli.permiso.Permiso: java.util.Map mCodesToRequests -> a java.lang.ref.WeakReference mActivity -> b int mActiveRequestCode -> c com.greysonparrelli.permiso.Permiso sInstance -> d 62:62:com.greysonparrelli.permiso.Permiso getInstance() -> a 46:70:void <init>() -> <init> 86:87:void setActivity(android.app.Activity) -> a 100:141:void requestPermissions(com.greysonparrelli.permiso.Permiso$IOnPermissionResult,java.lang.String[]) -> a 157:166:void onRequestPermissionResult(int,java.lang.String[],int[]) -> a 187:192:void showRationaleInDialog(java.lang.String,java.lang.String,java.lang.String,com.greysonparrelli.permiso.Permiso$IOnRationaleProvided) -> a 207:226:void showRationaleInDialog(com.greysonparrelli.permiso.PermisoDialogFragment$Builder,com.greysonparrelli.permiso.Permiso$IOnRationaleProvided) -> a 240:273:boolean linkToExistingRequestIfPossible(com.greysonparrelli.permiso.Permiso$RequestData) -> a 281:283:int markRequestAsActive(com.greysonparrelli.permiso.Permiso$RequestData) -> b 291:294:void makePermissionRequest(int) -> a 301:305:android.app.Activity checkActivity() -> b 25:25:void access$200(com.greysonparrelli.permiso.Permiso,int) -> a 51:51:void <clinit>() -> <clinit> com.greysonparrelli.permiso.Permiso$1 -> com.greysonparrelli.permiso.Permiso$1: int val$requestCode -> a com.greysonparrelli.permiso.Permiso this$0 -> b 130:130:void <init>(com.greysonparrelli.permiso.Permiso,int) -> <init> 133:134:void onRationaleProvided() -> a com.greysonparrelli.permiso.Permiso$2 -> com.greysonparrelli.permiso.Permiso$2: com.greysonparrelli.permiso.Permiso$IOnRationaleProvided val$rationaleCallback -> a com.greysonparrelli.permiso.Permiso this$0 -> b 219:219:void <init>(com.greysonparrelli.permiso.Permiso,com.greysonparrelli.permiso.Permiso$IOnRationaleProvided) -> <init> 222:223:void onClose() -> a

Hey, so I hopefully fixed this in the commit that is referenced. You can point your permiso version to the latest dev version, as detailed in the README.

Best I could tell, something weird is going on during a rationale request. After following the code path, I concluded that you must get into a situation where the permission request is completed before the rationale is given. Then, when the rationale thing is finished, it tries to grab the pending permission request and fails (since it was already completed).

I basically just make sure it always has the original (non-null) request. That means that in these situations where you're currently crashing, the request just may go through again, which is no big deal, as it'll likely be auto-approved/denied by the system.

Please let me know if you continue to encounter this issue or any others!