Skip to content

Commit

Permalink
Fixed UncaughtExceptionHandler not using the supplied base-TrackMe if…
Browse files Browse the repository at this point in the history
… supplied. (#128)
  • Loading branch information
d4rken committed Oct 28, 2016
1 parent d4393b4 commit dc66ae9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@

package org.piwik.sdk;

import android.support.annotation.NonNull;
import android.support.annotation.Nullable;

import timber.log.Timber;

/**
Expand All @@ -19,7 +22,7 @@ public class PiwikExceptionHandler implements Thread.UncaughtExceptionHandler {
private final TrackMe mTrackMe;
private final Thread.UncaughtExceptionHandler mDefaultExceptionHandler;

public PiwikExceptionHandler(Tracker tracker, TrackMe trackMe) {
public PiwikExceptionHandler(@NonNull Tracker tracker, @Nullable TrackMe trackMe) {
mTracker = tracker;
mTrackMe = trackMe;
mDefaultExceptionHandler = Thread.getDefaultUncaughtExceptionHandler();
Expand All @@ -40,7 +43,7 @@ public Thread.UncaughtExceptionHandler getDefaultExceptionHandler() {
public void uncaughtException(Thread thread, Throwable ex) {
try {
String excInfo = ex.getMessage();
TrackHelper.track().exception(ex).description(excInfo).fatal(true).with(getTracker());
TrackHelper.track(mTrackMe).exception(ex).description(excInfo).fatal(true).with(getTracker());
// Immediately dispatch as the app might be dying after rethrowing the exception
getTracker().dispatch();
} catch (Exception e) {
Expand Down
2 changes: 1 addition & 1 deletion piwik-sdk/src/main/java/org/piwik/sdk/TrackHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public static TrackHelper track() {
return new TrackHelper();
}

public static TrackHelper track(@NonNull TrackMe base) {
public static TrackHelper track(@Nullable TrackMe base) {
return new TrackHelper(base);
}

Expand Down

0 comments on commit dc66ae9

Please sign in to comment.