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

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

Issue 10386106: Fixed crashes when data is NULL. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 7 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 | « chrome/browser/ui/webui/print_preview/print_preview_handler.h ('k') | 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 3b9cda3c09ef8f65a4737c79effe7f798e1bd580..494c6dce253860f9a21b123fd566f88399d4e599 100644
--- a/chrome/browser/ui/webui/print_preview/print_preview_handler.cc
+++ b/chrome/browser/ui/webui/print_preview/print_preview_handler.cc
@@ -714,7 +714,7 @@ void PrintPreviewHandler::SendCloudPrintJob(const DictionaryValue& settings,
web_ui()->GetController());
print_preview_ui->GetPrintPreviewDataForIndex(
printing::COMPLETE_PREVIEW_DOCUMENT_INDEX, &data);
- if (data->size() > 0U && data->front()) {
+ if (data.get() && data->size() > 0U && data->front()) {
string16 print_job_title_utf16 =
preview_tab_wrapper()->print_view_manager()->RenderSourceName();
std::string print_job_title = UTF16ToUTF8(print_job_title_utf16);
@@ -840,12 +840,14 @@ void PrintPreviewHandler::FileSelected(const FilePath& path,
print_preview_ui->GetPrintPreviewDataForIndex(
printing::COMPLETE_PREVIEW_DOCUMENT_INDEX, &data);
print_to_pdf_path_.reset(new FilePath(path));
- if (data.get())
- PostPrintToPdfTask(data);
+ PostPrintToPdfTask(data);
}
-void PrintPreviewHandler::PostPrintToPdfTask(
- scoped_refptr<base::RefCountedBytes> data) {
+void PrintPreviewHandler::PostPrintToPdfTask(base::RefCountedBytes* data) {
+ if (!data) {
+ NOTREACHED();
+ return;
+ }
printing::PreviewMetafile* metafile = new printing::PreviewMetafile;
metafile->InitFromData(static_cast<const void*>(data->front()), data->size());
// PrintToPdfCallback takes ownership of |metafile|.
« no previous file with comments | « chrome/browser/ui/webui/print_preview/print_preview_handler.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698