Skip to content

Commit

Permalink
Fix NPE for host printing
Browse files Browse the repository at this point in the history
Closes qzind#672
  • Loading branch information
tresf committed Jun 16, 2020
1 parent 27a95fd commit f9c38f2
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/qz/printer/PrintOptions.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import java.awt.print.PageFormat;
import java.awt.print.PrinterException;
import java.awt.print.PrinterJob;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;

Expand Down Expand Up @@ -113,7 +114,8 @@ public PrintOptions(JSONObject configOpts, PrintOutput output, PrintingUtilities
psOptions.density = asymmDPI.optInt("feed");
psOptions.crossDensity = asymmDPI.optInt("cross");
} else {
List<PrinterResolution> rSupport = output.getNativePrinter().getResolutions();
List<PrinterResolution> rSupport = output.isSetService() ?
output.getNativePrinter().getResolutions() : new ArrayList<>();

JSONArray possibleDPIs = configOpts.optJSONArray("density");
if (possibleDPIs != null && possibleDPIs.length() > 0) {
Expand Down

0 comments on commit f9c38f2

Please sign in to comment.