Commit 18766e6b authored by Tanya Gupta's avatar Tanya Gupta Committed by Commit Bot

[SendTabToSelf] Potentially fixed sigsev in ShouldOfferFeature.

The function assumed that all calls would return non-null pointers.
Fixed that to explictly check for nullptr.

Bug: 950640
Change-Id: I7b1ff107b3dd6b94b439f486779cfefe2ae1688e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1577977Reviewed-by: default avatarsebsg <sebsg@chromium.org>
Reviewed-by: default avatarMikel Astiz <mastiz@chromium.org>
Commit-Queue: Tanya Gupta <tgupta@chromium.org>
Cr-Commit-Position: refs/heads/master@{#653360}
parent d61bd53e
......@@ -34,15 +34,19 @@ bool IsSendingEnabled() {
}
bool IsUserSyncTypeActive(Profile* profile) {
return SendTabToSelfSyncServiceFactory::GetForProfile(profile)
->GetSendTabToSelfModel()
->IsReady();
SendTabToSelfSyncService* service =
SendTabToSelfSyncServiceFactory::GetForProfile(profile);
// The service will be null if the user is in incognito mode so better to
// check for that.
return service && service->GetSendTabToSelfModel() &&
service->GetSendTabToSelfModel()->IsReady();
}
bool IsSyncingOnMultipleDevices(Profile* profile) {
syncer::DeviceInfoSyncService* device_sync_service =
DeviceInfoSyncServiceFactory::GetForProfile(profile);
return device_sync_service &&
return device_sync_service && device_sync_service->GetDeviceInfoTracker() &&
device_sync_service->GetDeviceInfoTracker()->CountActiveDevices() > 1;
}
......@@ -55,8 +59,9 @@ bool IsContentRequirementsMet(const GURL& url, Profile* profile) {
}
bool ShouldOfferFeature(content::WebContents* web_contents) {
if (!web_contents)
if (!web_contents) {
return false;
}
Profile* profile =
Profile::FromBrowserContext(web_contents->GetBrowserContext());
......
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