Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(723)

Unified Diff: chrome/browser/ui/webui/print_preview/print_preview_handler.cc

Issue 2980603002: Print Preview: Return or crash on failures (Closed)
Patch Set: Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/webui/print_preview/print_preview_handler.cc
diff --git a/chrome/browser/ui/webui/print_preview/print_preview_handler.cc b/chrome/browser/ui/webui/print_preview/print_preview_handler.cc
index 222b4d90eec7b3c963d3eba8118c5696443d5377..324844262a3cada58b97307f4a4c34f51c20b82a 100644
--- a/chrome/browser/ui/webui/print_preview/print_preview_handler.cc
+++ b/chrome/browser/ui/webui/print_preview/print_preview_handler.cc
@@ -686,6 +686,7 @@ void PrintPreviewHandler::HandleGetPrivetPrinters(const base::ListValue* args) {
if (!PrivetPrintingEnabled()) {
RejectJavascriptCallback(base::Value(callback_id), base::Value());
+ return;
}
#if BUILDFLAG(ENABLE_SERVICE_DISCOVERY)
using local_discovery::ServiceDiscoverySharedClient;
@@ -884,13 +885,14 @@ void PrintPreviewHandler::HandlePrint(const base::ListValue* args) {
CHECK(args->GetString(0, &callback_id));
CHECK(!callback_id.empty());
std::string json_str;
- if (!args->GetString(1, &json_str))
- RejectJavascriptCallback(base::Value(callback_id), base::Value(-1));
+ CHECK(args->GetString(1, &json_str));
std::unique_ptr<base::DictionaryValue> settings =
GetSettingsDictionary(json_str);
- if (!settings)
+ if (!settings) {
RejectJavascriptCallback(base::Value(callback_id), base::Value(-1));
+ return;
+ }
ReportPrintSettingsStats(*settings);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698