diff --git a/chrome/browser/data_sharing/desktop/data_sharing_sdk_delegate_desktop.cc b/chrome/browser/data_sharing/desktop/data_sharing_sdk_delegate_desktop.cc index 5ff23debd6e05..8da216b8af183 100644 --- a/chrome/browser/data_sharing/desktop/data_sharing_sdk_delegate_desktop.cc +++ b/chrome/browser/data_sharing/desktop/data_sharing_sdk_delegate_desktop.cc @@ -150,8 +150,10 @@ void DataSharingSDKDelegateDesktop::MaybeLoadWebContents( // If the API is already initialized, run the callback here, otherwise add the // callback to the queue and run it when `ApiInitComplete` is called. + CHECK(web_contents_->GetWebUI()); DataSharingUI* data_sharing_ui = - static_cast(web_contents_->GetWebUI()->GetController()); + web_contents_->GetWebUI()->GetController()->GetAs(); + CHECK(data_sharing_ui); if (data_sharing_ui->IsApiInitialized()) { std::move(callback).Run(web_contents_.get()); } else {