[MOD-2397] Ti.Facebook: Uncaught exception when accessing "getExpirationDate()" on invalid access-token
GitHub Issue | n/a |
---|---|
Type | Improvement |
Priority | Critical |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2018-02-10T18:04:05.000+0000 |
Affected Version/s | n/a |
Fix Version/s | Ti.Facebook iOS 4.7.1, Ti.Facebook Android 7.1.1 |
Components | |
Labels | n/a |
Reporter | David Benko |
Assignee | Hans Knöchel |
Created | 2018-02-08T17:31:17.000+0000 |
Updated | 2018-08-06T17:49:11.000+0000 |
Description
In my app I log uncaught exceptions that happens, and frequently I get the following error:
Uncaught Attempt to invoke virtual method 'java.util.Date com.facebook.AccessToken.getExpires()' on a null object reference
I suppose is some error in the internal java code on the Facebook module that happens when the user logs in. Unfortunatelly I dont have more info on the error because I can't reproduce, but from the error description itself it seems like some null verifications are missing in the module
Hello, Can you provide a trace log of your issue? Without the trace log or a sample reproducible code, we are unable to help you. Thanks.
Check this line: https://github.com/appcelerator-modules/ti.facebook/blob/master/android/src/facebook/TiFacebookModule.java#L342 The problem is the call
Beucase AccessToken.getCurrentAccessToken() returns null then .getExpires() is called on null reference. You can see that other methods have a null check before:
Just need to add a null check to getExpirationDate method too
Thanks for the details! We can fix that. But I am still wondering if you couldn't just check for the
accessToken
orloggedIn
property before and only callgetExpirationDate()
if it's valid.New release: https://github.com/appcelerator-modules/ti.facebook/releases/tag/android-7.1.1
Cleaning up older fixed issues. If this issue should not have been closed as fixed, please reopen.