Skip to content

Commit 81c20a2

Browse files
committed
Add more NPE guards for default printer
Closes #948
1 parent 67b6448 commit 81c20a2

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/qz/printer/PrintServiceMatcher.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,10 @@ public static NativePrinterMap getNativePrinterList() {
5050
public static NativePrinter getDefaultPrinter() {
5151
PrintService defaultService = PrintServiceLookup.lookupDefaultPrintService();
5252

53+
if(defaultService == null) {
54+
return null;
55+
}
56+
5357
NativePrinterMap printers = NativePrinterMap.getInstance();
5458
if (!printers.contains(defaultService)) {
5559
printers.putAll(defaultService);

0 commit comments

Comments
 (0)