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|. |