Commit 8d0f3820 authored by Owen Min's avatar Owen Min Committed by Chromium LUCI CQ

Fix a crash when last profile is not ready during startup

KeyedServiceFactory crash when passing in a null pointer. Hence check
the pointer ahead of time and return NO early like other code in the
same function.

Bug: chromium:1161109
Change-Id: I3addf01456f27f42e97dcb3810cf367731279921
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2618201Reviewed-by: default avatarAvi Drissman <avi@chromium.org>
Commit-Queue: Owen Min <zmin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#841656}
parent 49d15f6e
......@@ -1282,9 +1282,14 @@ static base::mac::ScopedObjCClassSwizzler* g_swizzle_imk_input_session;
(!doneOnce && base::mac::WasLaunchedAsHiddenLoginItem());
doneOnce = YES;
if (attemptRestore) {
Profile* lastProfile = [self lastProfile];
if (!lastProfile) {
// There is no session to be restored without a valid profile. Return NO
// to do nothing.
return NO;
}
SessionService* sessionService =
SessionServiceFactory::GetForProfileForSessionRestore(
[self lastProfile]);
SessionServiceFactory::GetForProfileForSessionRestore(lastProfile);
if (sessionService &&
sessionService->RestoreIfNecessary(std::vector<GURL>()))
return NO;
......
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