Skip to content

Commit

Permalink
Prevent possible crash unregistering VR BroadcastReceiver
Browse files Browse the repository at this point in the history
I only saw this crash once, and can't reproduce, but better safe than sorry.

BUG=712823

Review-Url: https://codereview.chromium.org/2830463002
Cr-Commit-Position: refs/heads/master@{#465702}
(cherry picked from commit 3eb6c9f)

Review-Url: https://codereview.chromium.org/2826213002 .
Cr-Commit-Position: refs/branch-heads/3071@{#62}
Cr-Branched-From: a106f0a-refs/heads/master@{#464641}
  • Loading branch information
Michael Thiessen committed Apr 19, 2017
1 parent 075f4f0 commit 31f6c16
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,11 @@ public void onReceive(Context context, Intent intent) {
public void unregister() {
ChromeActivity activity = mTargetActivity.get();
if (activity == null) return;
activity.unregisterReceiver(VrBroadcastReceiver.this);
try {
activity.unregisterReceiver(VrBroadcastReceiver.this);
} catch (IllegalArgumentException e) {
// Ignore this. This means our receiver was already unregistered somehow.
}
}
}

Expand Down

0 comments on commit 31f6c16

Please sign in to comment.