宁校航
Committed by David PHAM-VAN

fix crash when Android load a PDF file which had password

@@ -3,6 +3,7 @@ @@ -3,6 +3,7 @@
3 ## 5.7.3 3 ## 5.7.3
4 4
5 - Update pdfium version to 4861 5 - Update pdfium version to 4861
  6 +- Fix crash when Android load a PDF file which had password
6 7
7 ## 5.7.2 8 ## 5.7.2
8 9
@@ -507,6 +507,19 @@ public class PrintingJob extends PrintDocumentAdapter { @@ -507,6 +507,19 @@ public class PrintingJob extends PrintDocumentAdapter {
507 } 507 }
508 }); 508 });
509 509
  510 + thread.setUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() {
  511 + @Override
  512 + public void uncaughtException(Thread t, Throwable e) {
  513 + final String finalError = e.getMessage();
  514 + new Handler(Looper.getMainLooper()).post(new Runnable() {
  515 + @Override
  516 + public void run() {
  517 + printing.onPageRasterEnd(PrintingJob.this, finalError);
  518 + }
  519 + });
  520 + }
  521 + });
  522 +
510 thread.start(); 523 thread.start();
511 } 524 }
512 } 525 }
@@ -93,7 +93,7 @@ public class PrintJob: UIPrintPageRenderer, UIPrintInteractionControllerDelegate @@ -93,7 +93,7 @@ public class PrintJob: UIPrintPageRenderer, UIPrintInteractionControllerDelegate
93 } 93 }
94 94
95 let printer = UIPrinter(url: printerURL!) 95 let printer = UIPrinter(url: printerURL!)
96 - printer.contactPrinter { available -> Void in 96 + printer.contactPrinter { available in
97 if !available { 97 if !available {
98 printing.onCompleted(printJob: self, completed: false, error: "Printer not available") 98 printing.onCompleted(printJob: self, completed: false, error: "Printer not available")
99 return 99 return