fix: check WebContents in OnGetDefaultPrinter (#22041)
This commit is contained in:
parent
76d05ce21f
commit
dee324f79a
1 changed files with 8 additions and 0 deletions
|
@ -1745,6 +1745,14 @@ void WebContents::OnGetDefaultPrinter(
|
||||||
base::string16 device_name,
|
base::string16 device_name,
|
||||||
bool silent,
|
bool silent,
|
||||||
base::string16 default_printer) {
|
base::string16 default_printer) {
|
||||||
|
// The content::WebContents might be already deleted at this point, and the
|
||||||
|
// PrintViewManagerBasic class does not do null check.
|
||||||
|
if (!web_contents()) {
|
||||||
|
if (print_callback)
|
||||||
|
std::move(print_callback).Run(false, "failed");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
base::string16 printer_name =
|
base::string16 printer_name =
|
||||||
device_name.empty() ? default_printer : device_name;
|
device_name.empty() ? default_printer : device_name;
|
||||||
print_settings.SetStringKey(printing::kSettingDeviceName, printer_name);
|
print_settings.SetStringKey(printing::kSettingDeviceName, printer_name);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue