Permalink
Browse files

PDFBOX-4248: avoid NPE which can happen with a Batik graphics object

git-svn-id: https://svn.apache.org/repos/asf/pdfbox/trunk@1833945 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information...
THausherr committed Jun 20, 2018
1 parent 8dd69d5 commit 6776073c0bde99bb3987c8012423676595bbb18b
Showing with 6 additions and 1 deletion.
  1. +6 −1 pdfbox/src/main/java/org/apache/pdfbox/rendering/PageDrawer.java
@@ -1175,7 +1175,12 @@ public void showAnnotation(PDAnnotation annotation) throws IOException
lastClip = null;
//TODO support more annotation flags (Invisible, NoZoom, NoRotate)
// Example for NoZoom can be found in p5 of PDFBOX-2348
- int deviceType = graphics.getDeviceConfiguration().getDevice().getType();
+ int deviceType = -1;
+ if (graphics.getDeviceConfiguration() != null &&
+ graphics.getDeviceConfiguration().getDevice() != null)
+ {
+ deviceType = graphics.getDeviceConfiguration().getDevice().getType();
+ }
if (deviceType == GraphicsDevice.TYPE_PRINTER && !annotation.isPrinted())
{
return;

0 comments on commit 6776073

Please sign in to comment.