Skip to content

Commit

Permalink
Fix to avoid crash when the user is not logged in but getMyId is called
Browse files Browse the repository at this point in the history
  • Loading branch information
Imanol Martin committed Dec 8, 2015
1 parent 6851a25 commit ec06edb
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/cordova/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cocoon-plugin-social-android-googleplaygames",
"version": "1.0.5",
"version": "1.0.6",
"description": "Android Google Play Games API",
"cordova": {
"id": "cocoon-plugin-social-android-googleplaygames",
Expand Down
11 changes: 8 additions & 3 deletions src/cordova/src/android/GPGService.java
Original file line number Diff line number Diff line change
Expand Up @@ -342,9 +342,14 @@ public boolean isLoggedIn()

private String getMyId() {
if (isLoggedIn()) {
Person p = Plus.PeopleApi.getCurrentPerson(client);
if (p != null) {
return p.getId();
try {
Person p = Plus.PeopleApi.getCurrentPerson(client);
if (p != null) {
return p.getId();
}

} catch(IllegalStateException e) {
e.printStackTrace();
}
}

Expand Down

0 comments on commit ec06edb

Please sign in to comment.