From 19421af4c899a4537e50ce7fe9a85c3e7e00b102 Mon Sep 17 00:00:00 2001 From: daviddalbusco Date: Sat, 28 Apr 2018 10:39:33 +0200 Subject: [PATCH] #568: Fix null pointer exception crashing app after 2nd login --- CHANGELOG.md | 7 +++++++ package.json | 2 +- plugin.xml | 2 +- src/android/ConnectPlugin.java | 5 ++++- 4 files changed, 13 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ae70305c9..c1e5dc394 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ + +# [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)) + # [2.0.0](https://github.com/jeduan/cordova-plugin-facebook4/releases/tag/v2.0.0) diff --git a/package.json b/package.json index 44db5c53c..898dafd0a 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/plugin.xml b/plugin.xml index 8f400d45d..5d8ed5e6f 100644 --- a/plugin.xml +++ b/plugin.xml @@ -2,7 +2,7 @@ + version="2.0.1"> Facebook Connect diff --git a/src/android/ConnectPlugin.java b/src/android/ConnectPlugin.java index 0401865af..3aa97ce22 100644 --- a/src/android/ConnectPlugin.java +++ b/src/android/ConnectPlugin.java @@ -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; @@ -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 permissions = new HashSet(args.length());