You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pdfbox.apache.org by ti...@apache.org on 2018/06/20 20:00:11 UTC

svn commit: r1833946 - /pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/rendering/PageDrawer.java

Author: tilman
Date: Wed Jun 20 20:00:11 2018
New Revision: 1833946

URL: http://svn.apache.org/viewvc?rev=1833946&view=rev
Log:
PDFBOX-4248: avoid NPE which can happen with a Batik graphics object

Modified:
    pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/rendering/PageDrawer.java

Modified: pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/rendering/PageDrawer.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/rendering/PageDrawer.java?rev=1833946&r1=1833945&r2=1833946&view=diff
==============================================================================
--- pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/rendering/PageDrawer.java (original)
+++ pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/rendering/PageDrawer.java Wed Jun 20 20:00:11 2018
@@ -1243,7 +1243,12 @@ public class PageDrawer extends PDFGraph
         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;