Commit 581c5da1 authored by Alan Cutter's avatar Alan Cutter Committed by Commit Bot

desktop-pwas: Check for nullptr return from CreateWebApp()

This CL adds a null check for the return value of CreateWebApp().
It's valid for this function to return nullptr in the event of DB
corruption so we must check for it.

Bug: 1086775
Change-Id: Idd491a136537540f8a65cd466d65772fbdc66300
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2217990
Commit-Queue: Alan Cutter <alancutter@chromium.org>
Commit-Queue: Alexey Baskakov <loyso@chromium.org>
Auto-Submit: Alan Cutter <alancutter@chromium.org>
Reviewed-by: default avatarAlexey Baskakov <loyso@chromium.org>
Cr-Commit-Position: refs/heads/master@{#772531}
parent cb5bc1e9
......@@ -443,6 +443,11 @@ std::unique_ptr<WebApp> WebAppDatabase::ParseWebApp(const AppId& app_id,
}
auto web_app = CreateWebApp(proto);
if (!web_app) {
// CreateWebApp() already logged what went wrong here.
return nullptr;
}
if (web_app->app_id() != app_id) {
DLOG(ERROR) << "WebApps LevelDB error: app_id doesn't match storage key";
return nullptr;
......
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