Skip to content

Commit

Permalink
Add more NPE guards for default printer
Browse files Browse the repository at this point in the history
Closes qzind#948
  • Loading branch information
tresf committed Mar 25, 2022
1 parent 1123c78 commit 2442cd2
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/qz/printer/PrintServiceMatcher.java
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ public static NativePrinterMap getNativePrinterList() {
public static NativePrinter getDefaultPrinter() {
PrintService defaultService = PrintServiceLookup.lookupDefaultPrintService();

if(defaultService == null) {
return null;
}

NativePrinterMap printers = NativePrinterMap.getInstance();
if (!printers.contains(defaultService)) {
printers.putAll(defaultService);
Expand Down

0 comments on commit 2442cd2

Please sign in to comment.