Commit 8513f514 authored by Mathieu Perreault's avatar Mathieu Perreault Committed by Commit Bot

[Payments] Card unmask controller: nullcheck the delegate

The |delegate_| might be gone when the unmask response comes (we have
seen crashes). Guard it.

Bug: None
Change-Id: I4d656c0379c76383b616d564cf2d1dc024cffaf7
Reviewed-on: https://chromium-review.googlesource.com/827032
Commit-Queue: Mathieu Perreault <mathp@chromium.org>
Reviewed-by: default avatarRoger McFarlane <rogerm@chromium.org>
Cr-Commit-Position: refs/heads/master@{#524214}
parent f90a9b1f
......@@ -117,7 +117,7 @@ void CardUnmaskPromptControllerImpl::OnVerificationResult(
void CardUnmaskPromptControllerImpl::OnUnmaskDialogClosed() {
card_unmask_view_ = nullptr;
LogOnCloseEvents();
if (delegate_.get())
if (delegate_)
delegate_->OnUnmaskPromptClosed();
}
......@@ -208,7 +208,10 @@ void CardUnmaskPromptControllerImpl::OnUnmaskResponse(
pending_response_.should_store_pan = false;
}
delegate_->OnUnmaskResponse(pending_response_);
// There is a chance the delegate has disappeared (i.e. tab closed) before the
// unmask response came in. Avoid a crash.
if (delegate_)
delegate_->OnUnmaskResponse(pending_response_);
}
void CardUnmaskPromptControllerImpl::NewCardLinkClicked() {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment