Skip to content

Commit

Permalink
jeduan#568: Fix null pointer exception crashing app after 2nd login
Browse files Browse the repository at this point in the history
  • Loading branch information
peterpeterparker committed Apr 28, 2018
1 parent b19e216 commit 19421af
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 3 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
<a name="2.0.1"></a>
# [2.0.1](https://github.com/jeduan/cordova-plugin-facebook4/releases/tag/v2.0.1)

## Bug fixes

* **Android:** Fix null pointer exception leading to app crashing after a second login (flow example: login -> graphApi -> logout -> login -> crash) ([#568](https://github.com/jeduan/cordova-plugin-facebook4/issues/568))

<a name="2.0.0"></a>
# [2.0.0](https://github.com/jeduan/cordova-plugin-facebook4/releases/tag/v2.0.0)

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cordova-plugin-facebook4",
"version": "2.0.0",
"version": "2.0.1",
"description": "Cordova Facebook SDK 4 Plugin",
"cordova": {
"id": "cordova-plugin-facebook4",
Expand Down
2 changes: 1 addition & 1 deletion plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
xmlns:android="http://schemas.android.com/apk/res/android"
id="cordova-plugin-facebook4"
version="2.0.0">
version="2.0.1">

<name>Facebook Connect</name>

Expand Down
5 changes: 4 additions & 1 deletion src/android/ConnectPlugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import com.facebook.applinks.AppLinkData;
import com.facebook.login.LoginManager;
import com.facebook.login.LoginResult;
import com.facebook.share.ShareApi;
import com.facebook.share.Sharer;
import com.facebook.share.model.GameRequestContent;
import com.facebook.share.model.ShareHashtag;
Expand Down Expand Up @@ -634,6 +633,10 @@ private void executeLogEvent(JSONArray args, CallbackContext callbackContext) th

private void executeLogin(JSONArray args, CallbackContext callbackContext) throws JSONException {
Log.d(TAG, "login FB");

// #568: Reset lastGraphContext in case it would still contains the last graphApi results of a previous session (login -> graphApi -> logout -> login)
lastGraphContext = null;

// Get the permissions
Set<String> permissions = new HashSet<String>(args.length());

Expand Down

0 comments on commit 19421af

Please sign in to comment.