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 2014/07/21 20:00:51 UTC

svn commit: r1612360 - /pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/util/operator/state/Restore.java

Author: tilman
Date: Mon Jul 21 18:00:51 2014
New Revision: 1612360

URL: http://svn.apache.org/r1612360
Log:
PDFBOX-2214: graphics stack must have at least one element because of peek() in PDFStreamEngine

Modified:
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/util/operator/state/Restore.java

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/util/operator/state/Restore.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/util/operator/state/Restore.java?rev=1612360&r1=1612359&r2=1612360&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/util/operator/state/Restore.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/util/operator/state/Restore.java Mon Jul 21 18:00:51 2014
@@ -36,14 +36,14 @@ public class Restore extends OperatorPro
     @Override
     public void process(Operator operator, List<COSBase> arguments)
     {
-    	if (context.getGraphicsStackSize() > 0)
-    	{
-    		context.restoreGraphicsState();
-    	}
-    	else
-    	{
-    		// this shouldn't happen but it does, see PDFBOX-161
-    		LOG.debug("GRestore: no graphics state left to be restored.");
-    	}
+        if (context.getGraphicsStackSize() > 1)
+        {
+            context.restoreGraphicsState();
+        }
+        else
+        {
+            // this shouldn't happen but it does, see PDFBOX-161
+            LOG.error("GRestore: no graphics state left to be restored.");
+        }
     }
 }