Skip to content

Commit

Permalink
Fix NPE crash in repost form warning.
Browse files Browse the repository at this point in the history
Repro steps:
1.) Turn on "Don't keep activities"
2.) Navigate to a test form site:
   https://www.cs.tut.fi/~jkorpela/forms/testing.html
3.) Submit POST form
4.) Refresh
5.) Hit the home button (causing the activity to be destroyed
    per #1

It crashes in the destruction path as the fragment manager has
been destroyed.

Add a safety check to prevent the crash.

BUG=598196

Review URL: https://codereview.chromium.org/1836053002

Cr-Commit-Position: refs/heads/master@{#383574}

Review URL: https://codereview.chromium.org/1837073002 .

Cr-Commit-Position: refs/branch-heads/2661@{#409}
Cr-Branched-From: ef6f6ae-refs/heads/master@{#378081}
  • Loading branch information
Ted Choc committed Mar 28, 2016
1 parent d4fef28 commit be84806
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,12 @@ public void onClick(DialogInterface dialog, int id) {
return dialog;
}

@Override
public void dismiss() {
if (getFragmentManager() == null) return;
super.dismiss();
}

@Override
public void onDismiss(DialogInterface dialog) {
super.onDismiss(dialog);
Expand Down

0 comments on commit be84806

Please sign in to comment.