diff --git a/src/macosx/classes/sun/lwawt/macosx/CPrinterJob.java b/src/macosx/classes/sun/lwawt/macosx/CPrinterJob.java index 4530fff6976beb9fe6443a83563ac5f7371889b1..4de4d57899dcf82a7ebc666a630dfd46f8e53cc0 100644 --- a/src/macosx/classes/sun/lwawt/macosx/CPrinterJob.java +++ b/src/macosx/classes/sun/lwawt/macosx/CPrinterJob.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -234,6 +234,11 @@ public final class CPrinterJob extends RasterPrinterJob { // this will not work if the user clicks on the "Preview" button // However if the printer is a StreamPrintService, its the right path. PrintService psvc = getPrintService(); + + if (psvc == null) { + throw new PrinterException("No print service found."); + } + if (psvc instanceof StreamPrintService) { spoolToService(psvc, attributes); return; @@ -775,4 +780,4 @@ public final class CPrinterJob extends RasterPrinterJob { (float) (paper.getImageableHeight() / dpi), MediaPrintableArea.INCH); } -} \ No newline at end of file +}