Skip to content

Commit

Permalink
ViewRef nullable
Browse files Browse the repository at this point in the history
  • Loading branch information
romtsn committed May 13, 2022
1 parent 827df9d commit 15e4347
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public final class SentryGestureListener implements GestureDetector.OnGestureLis
private final @NotNull SentryAndroidOptions options;
private final boolean isAndroidXAvailable;

private @NotNull WeakReference<View> activeView = new WeakReference<>(null);
private @Nullable WeakReference<View> activeView = null;
private @Nullable ITransaction activeTransaction = null;
private @Nullable String activeEventType = null;

Expand Down Expand Up @@ -219,7 +219,7 @@ private void startTracing(final @NotNull View target, final @NotNull String even
return;
}

final View view = activeView.get();
final View view = (activeView != null) ? activeView.get() : null;
if (activeTransaction != null) {
if (target.equals(view)
&& eventType.equals(activeEventType)
Expand Down Expand Up @@ -271,7 +271,9 @@ void stopTracing(final @NotNull SpanStatus status) {
clearScope(scope);
});
activeTransaction = null;
activeView.clear();
if (activeView != null) {
activeView.clear();
}
activeEventType = null;
}

Expand Down

0 comments on commit 15e4347

Please sign in to comment.