Skip to content

Commit

Permalink
Merge pull request martincik#33 from bourgois/fix-issue-32
Browse files Browse the repository at this point in the history
Fix issue martincik#32 Activity Null error
  • Loading branch information
martincik authored Aug 23, 2016
2 parents e2d5cca + 224a447 commit 25f65e1
Showing 1 changed file with 15 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,11 @@ public void configure(String token, Boolean autoSend, int apiAuthType, String se
public void start() {

Activity currentActivity = getCurrentActivity();

if (currentActivity == null) {
// The currentActivity can be null if it is backgrounded / destroyed, so we simply
// no-op to prevent any null pointer exceptions.
return;
}
if (_initialized) {
FeedbackManager.register(currentActivity, _token, null);

Expand Down Expand Up @@ -112,6 +116,11 @@ public void start() {
@ReactMethod
public void checkForUpdate() {
Activity currentActivity = getCurrentActivity();
if (currentActivity == null) {
// The currentActivity can be null if it is backgrounded / destroyed, so we simply
// no-op to prevent any null pointer exceptions.
return;
}
if (_initialized) {
UpdateManager.register(currentActivity, _token);
}
Expand All @@ -120,6 +129,11 @@ public void checkForUpdate() {
@ReactMethod
public void feedback() {
Activity currentActivity = getCurrentActivity();
if (currentActivity == null) {
// The currentActivity can be null if it is backgrounded / destroyed, so we simply
// no-op to prevent any null pointer exceptions.
return;
}
if (_initialized) {
currentActivity.runOnUiThread(new Runnable() {
private Activity currentActivity;
Expand Down

0 comments on commit 25f65e1

Please sign in to comment.